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.

Create lists to select from

Create lists to select from - Python Tutorial

From the course: Rapid Application Development with Python

Start my 1-month free trial

Create lists to select from

- [Instructor] List boxes are used to hold a set of items, one or more of which can be selected and typically appear as a scrollable list. I've preloaded the code to create a list box at line eight. The choices clause at line nine creates the list with an initial set of items. At line 10, the list box is styled with a horizontal scroll, allows just one entry to be selected and is sorted. At line 11, I've positioned and sized the list box to fit on the panel. Having created the list box at line 12, I set the initial selection to the top of the list. Let's update the action taken by the testing button. In this event handler, I'll comment out the original print line. And I'll get the selected list box item. Listno equals self.lb_test.GetSelection. And I'll display its value. Print self.lb_test.GetString of the currently selected item, listno. Plus lives in Valhalla. When we run this, the list is displayed.…

Contents