Let's see how to perform this recipe:
- First, we create our Python OOP class as we did before when using tkinter, but this time we inherit from and extend the wx.Frame class. We name the class MainFrame.
- Create a new Python module and call it GUI_wxPython.py.
- Add the following code:
import wx BACKGROUNDCOLOR = (240, 240, 240, 255) class MainFrame(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.createWidgets() self.Show() def exitGUI(self, event): # callback self.Destroy() def createWidgets(self): self.CreateStatusBar() # wxPython built-in method self.createMenu() self.createNotebook()
- Add the following code to create a notebook widget:
#---------------------------------------------------------- ...