Since you are running on MSW the Python installer set up associations for both
.PY and .PYW files. You can either double-click on these type of files to run the Python interpreter
or on simply enter the name of the script file on the commandline. Note that the python demo
is most easily run by clicking on the "Start > All Programs > wxPython2.6 Docs Demos and Tools >
Run the wxPython DEMO" menu shortcut (I'm assuming you have ver 2.6and the demo installed).
You'll find out quickly when you start writing apps and running them from Explorer that if your script has an error in it,
either a Python or wxPython one, that a DOS box flashes on the screen and then disappears taking the error trace with it.
That's why I prefer to execute Python on the commandline. Any error traces will print out and stay visible
in the DOS box.
Later on you will find out that running .PYW wxPython files at the command line causes any of your debug
prints and error trace info to not be printed at all. If you double-click on a .PYW file from Explorer you'll
find the no DOS box is created in addition to the wxPython GUI.
So, this leaves you with the 2 options to start a program either at the commandline or from Explorer.
If you go the Explorer route there is a "trick" to setting up your app that causes a wxPython log window
to be automatically displayed whenever a "print" or error trace sends stuff to the console.
The code to do this is really simple but I've forgotten to save an example because I prefer commandline execution.
I'm sure someone on this list can show you how to do this. (See below)
While I'm at it, there are (only ?) two basic ways to structure a wxPython program:
1) The app is derived from wxPySimpleApp:
app = wxPySimpleApp ()
frame = wxFrame (None, -1, 'My Application', size=(200, 400))
#frame = MyFrame (None, -1, 'My Application', size=(200, 400))
frame.Show (True)
app.MainLoop ()
2) Subclass wxApp and create an OnInit method:
class MyApp (wxApp):
# wxWindows calls this method to initialize the application
def OnInit (self):
# Create an instance of our customized Frame class
frame = MyFrame (NULL, -1, "This is a test")
frame.Show (True)
# Tell wxWindows that this is our main window
self.SetTopWindow (frame)
# Return a success flag
return true
#end def OnInit
#end class MyApp
app = MyApp (False) # Create an instance of my application class
app.MainLoop () # Tell it to start processing events
Aha ! I just remembered how to set up the app to automatically create a text output window !
You must use the second app structure and change the next-to-last line to "app = MyApp (True)"
I hope this helps you get started.
Ray Pasco
Chanchao wrote:
路路路
Hi,
Questions don't get more basic than this I'm afraid, but after installing wxPython I did not see any icons created in the start menu.. Also searched fora wxpython.exe but .. nothing.
So how does one start this up? All the 'getting started' guides seem to assume that you've been able to open it up..
I did follow the instructions and installed Python in C:\Python24
Cheers,
Chanchao
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org