wxPython tutorial?

J

Jive Dadson

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")


import wx

from frame import Frame

class App(wx.App):
"""Application class."""

def OnInit(self):
self.frame = Frame()
self.frame.Show()
self.SetTopWindow(self.frame)
return True

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

if __name__ == '__main__':
main()
 
G

Greg Krohn

Jive said:
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
 
T

Tjarko de Jong

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?

While using "import wx" is cleaner the turorials uses often
"from wxpython import * " Thus function and class names are
changed.

change:
self.frame = Frame()
self.frame = wx.Frame()
 
T

Tjarko de Jong

Jive said:
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.

It keeps the namespace clear. see:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/wxpython/wxPython/docs/wxPackage.html?rev=HEAD
 
S

simo

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")

Probably a bit out-of-date, not using the wx namespace (wxFrame).

Here's a good tutorial: http://wxpython.org/tutorial.php

Which is from http://wiki.wxpython.org/index.cgi/How_20to_20Learn_20wxPython

All I needed, and much better than TKinter, although I've since moved onto PyQt.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,520
Latest member
KrisMacono

Latest Threads

Top