Sbaush wrote:
Now there is the file attached...
boy, you get hard to read code with a code generator.
However:
if __name__ == "__main__":
Manager = wxPySimpleApp(0)
wxInitAllImageHandlers()
MainView = MainView(None, -1, "")
Manager.SetTopWindow(MainView)
MainView.CenterOnScreen()
MainView.Show()
Manager.MainLoop()
MainView.button_1.Bind(EVT_BUTTON,self.onButton)
1) You can't do anything after the Mainloop is called! It doesn't return until you close the app.
2) you don't want to bind an event in the main module code, it should be bound in the Panel or Frame that's relevant. It's possible that you could write this line properly, then put it before the Show() call, but I'm not going to tell you how.
Put that line in MainView.__init__, after button_1 has been defined, and it should work.
3) In that line, you're binding to "self.onButton", What is "self" here? I don't think it's defined, you probably get an error after closing the app.
4) also you've re-bound MainView from a class to an instance of that class. That'll probably work, as you won't need that class again, but it's a bad habit to get into.
5) you don't need wxInitAllImageHandlers() any more. Minor point, but why waste the code.
6) When you're trying to figure out something -- start SMALL. Put a single button on a frame, and bind to it. It's be a lot easier to figure out, and a lot easier for us to help you.
7) Doesn't wxGlade give you a way to boiind the basic events?
8) Learn to crawl before you can walk. If you don't understand OO in Python, you're going to have a hard time with wxPython:
http://wiki.wxpython.org/index.cgi/How_20to_20Learn_20wxPython
9) As fabulous as wxGlade (and others) are, I htnk it's a good idea to at least learn the basics of wxPython by hand writing some code. It's be a lot easier to understand.
10) Or go straight to Dabo -- beat you to it Peter!
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov