This article mainly introduces examples of wxPython framework classes and panel classes, mainly implements custom framework classes and their complete calling methods, and the code is simple and efficient, it is the basis for further studying the wxPython Framework Class. if you need it, you can refer to the examples in this article to describe how to use the wxPython framework class and panel class, and share them with you for your reference. The specific analysis is as follows:
The implementation code is as follows:
Import wx class MyApp (wx. app): # Custom Application class. the class calls the custom framework class def OnInit (self): self. frame = MyFrame (None, title = "My Main Frame jb51.net") self. setTopWindow (self. frame) self. frame. show () return True class MyFrame (wx. frame): # custom framework class. the custom framework class has a panel attribute def _ init _ (self, parent, id = wx. ID_ANY, title = ""): super (MyFrame, self ). _ init _ (parent, id, title) # Attributes self. panel = wx. panel (self) if _ name _ = "_ main _": app = MyApp () app. mainLoop ()
Shows the program running effect:
I hope this article will help you with Python programming.