From the course: Rapid Application Development with Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use combo boxes

Use combo boxes - Python Tutorial

From the course: Rapid Application Development with Python

Start my 1-month free trial

Use combo boxes

- [Instructor] A combo box is a variation on a list box, and it's useful if only one value is to be selected. At line eight, I've defined the combo box "cb_test," which is a little simpler to code than the list box. At line 11, I've set the initial position to the top of the combo box, as we did for the list box, and at line 12, I've defined an event handler to take action as soon as the combo box selection changes. I've updated the event handler at line 17 to print out the selected value. A combo box can only have one selected value at any one time, so we don't need to get an index to find it. Let's run this. And we see, as I change the selection through the dropdown box, the message is immediately displayed.

Contents