May 2017
Beginner to intermediate
444 pages
11h 31m
English
First, we create our Python OOP class as we did before, using tkinter, but this time we inherit from and extend the wx.Frame class. For reasons of clarity, we no longer call our class OOP but, instead, rename it as MainFrame.
We also create a callback method that closes the GUI when we click the Exit menu item and declare a light-grey tuple as the background color for our GUI:
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 ...
Read now
Unlock full access