wxPython tutorial?

Greg Krohn greg.invalid at capra.us.invalid
Fri Feb 27 10:38:00 CET 2004


Jive Dadson wrote:
> I'm trying (without conspicuous success) to start learning
> wxPython.  Sooo... I opened the doc page wxPythonManual.html#wxpython-overview.
> The very first example does not work.  Try it.  I find much of what follows
> to be incomprehensible.  Is there a good tutorial for novices?
> 
> Here's the example that does not work.  ("No module named frame")
> 
[snip]

Weird. I've never seen imports like that with wxPython before. Try the 
following code, instead. Notice that I changed three things: I replaced 
the imports, changed "wx.App" and "Frame" to "wxApp" and "wxFrame", and 
changed the constructor args for the frame.

from wxPython.wx import *

class App(wxApp):
     def OnInit(self):
         self.frame = wxFrame(NULL, -1, "MyApp Frame")
         self.frame.Show()
         self.SetTopWindow(self.frame)
         return True

def main():
     app = App()
     app.MainLoop()

if __name__ == '__main__':
     main()



I'm not too sure about that tutorial you mentioned, but you can try 
these, also:

<http://wxpython.org/tut-part1.php> Starts off almost identical to what 
you had (except that this one woks). It's a short tutorial, though.

<http://tinyurl.com/oq0p> Lot's of information.


greg



More information about the Python-list mailing list