Python 3 WxPython Listbox or Listctrl Widget to Display List of Items in GUI Desktop App Full Project For Beginners

Python 3 WxPython Listbox or Listctrl Widget to Display List of Items in GUI Desktop App Full Project For Beginners

 

Welcome folks today in this blog post we will be looking at wxpython listbox or listctrl widget to display list of items. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the below library using the pip command as shown below

 

pip install wxpython

 

After installing this library you need to make an app.py file and copy paste the following code

 

app.py

 

import wx

class ListBoxFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'List Box Example', 
                size=(250, 200))
        panel = wx.Panel(self, -1)

        sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
                      'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
                      'twelve', 'thirteen', 'fourteen']

        listBox = wx.ListBox(panel, -1, (20, 20), (80, 120), sampleList, 
                wx.LB_SINGLE)
        listBox.SetSelection(3)
                
if __name__ == '__main__':
    app = wx.PySimpleApp()
    ListBoxFrame().Show()
    app.MainLoop()

 

See also  Python 3 Script to Check Single or Multiple Domains Availability and Whether Domain is Registered or not on Command Line Full Project For Beginners

 

If you execute the above python script by typing the below command

 

python app.py

 

 

Leave a Reply