I've been looking around the web for some help on how to do programming using wxPython. I like the Python language and I am intrigued by wxPython because it seems like it can make program's that look native on whichever computer it runs on (I only run Linux and the occasional Windows 9x/XP anyway). So I wanted to learn more...
Googling immediately came up with the wikipedia entry at http://en.wikipedia.org/wiki/WxPython. And from it I got the proverbial "Hello world" example running. The code is short and sweet:
import wx
class HelloFrame(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, -1, title, pos=(0,0), size=(320,240))
panel = wx.Panel(self, -1)
text = wx.StaticText(panel, -1, "Hello world!", wx.Point(10,5), wx.Size(-1, -1))
class HelloApp(wx.App):
def OnInit(self):
frame = HelloFrame(None, -1, "Hello, world!")
self.SetTopWindow(frame)
frame.Show(True)
return True
if __name__== '__main__':
app = HelloApp()
app.MainLoop()
And it can be understood almost immediately. But keeping on with my search, I couldn't find a very comprehensive and easy to follow reference for wxPython. At most I found the alphabetical listing of the classes available at http://wxwidgets.org/manuals/stable/wx_classref.html#classref. So that is it for now in a sense. If I can get my head wrapped around it I might post some more of my findings. Oh well...
Saturday, January 12, 2008
Learning wxPython
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment