A Look at wxPython - Creating Windows and Status Bars
(Page 3 of 6 )
All right. Dialogs are fine to mess with for a while, but let's move on. (By the way, note that wxPython includes many more dialogs). Let's create a window:
from wxPython.wx import *
application = wxPySimpleApp()
dialog = wxFrame ( None, wxID_ANY, 'Title Here.' )
dialog.Show ( True )
application.MainLoop()
When creating a wxFrame, three arguments are passed, as you can see. The first argument is the parent, which you have already seen. Our window does not have a parent. The second argument is the ID of the object. We don't need to worry about it in this tutorial –- passing wxID_ANY will work fine. The third argument is, obviously, the title of the window.
Many applications have status bars at the bottom with certain text. We can add a simple one to our application:
from wxPython.wx import *
application = wxPySimpleApp()
window = wxFrame ( None, wxID_ANY, 'Title Here.' )
window.CreateStatusBar()
window.Show ( True )
application.MainLoop()
Next: Creating Menus >>
More Python Articles
More By Peyton McCullough