Here is a simple example for those getting started with Python GUI Programming, wxWidgets, and the wxPython Bindings.
This small program will display a Frame and the static text "Hello World!", positioned with a BoxSixer.
Output looks like this:
#!/usr/bin/env python import wx class Application(wx.Frame): def __init__(self, parent): wx.Frame.__init__(self, parent, -1, 'My GUI', size=(300, 200)) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) panel.SetSizer(sizer) txt = wx.StaticText(panel, -1, 'Hello World!') sizer.Add(txt, 0, wx.TOP|wx.LEFT, 20) self.Centre() self.Show(True) app = wx.App(0) Application(None) app.MainLoop()
Copyright © 2006-2008 Corey Goldberg
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.