Greetings, everyone,
I'm a research biologist. Nine years ago I worked for a medical
instrumentation company where my duties included some programming. We
were developing a data acquisition environment for Windows 3.1. After
devoting nine years to programming the most troublesome computers of
all, namely living cells, I have taken an interest in programming
silicon again. I asked some questions about the newest generation of
high-level programming languages, and ultimately ended up selecting
Python. I am very pleased with my choice, in no small measure due to
the great user community.
I've spent the last two months getting my feet wet with text-only
applications. I have written several utility programs in Python 2.2.2,
and I'm using the default shell for Windows, namely IDLE 0.8. It was
always my intention to return to GUI programming. I've made my first
attempts with wxWindows, and it's clear that I have to fix something
very basic before I can go anywhere.
Here's the bonehead-simple code. You've probably seen it on the
WxPython tutorial page.
···
----------
from wxPython.wx import *
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
----------
I load this code into IDLE, as I have done with all of my text-only
applications. Up pops a window, so far so good. You can resize it and
close it using the default wxFrame methods.
Now, I know that what I'm about to describe is irrelevant to this
particular application, but bear with me. In another GUI program I'm
writing, I'm (temporarily) using stdout to report event information,
which means that I tend to want to rearrange the windows a bit.
If, after my window comes up, I shift the focus to an IDLE window and
try to move or resize it, the whole IDLE environment crashes. Up pops
a dialog box which reads: "Microsoft Visual C++ Runtime Library /
Runtime Error! / Program C:\Python22\pythonw.exe / abnormal program
termination".
This only happens when I try to adjust an IDLE window which is clipped
by my application window. If I move or resize windows owned by other
applications, or if I've resized the IDLE windows so that they do not
clip my application window prior to executing the script, then
everything behaves gracefully.
WxWindows comes with these two applications called PyCrust and
PyShell. They look and feel as if should somehow substitute for IDLE.
But I'll be darned if I can figure out how to actually run a script...
the menu bar doesn't include an "open" selection, and the help files
appear to be a Python language reference, rather than a reference to
the shell itself.
Is my crash the result of a conflict between Tkinter and wxWindows?
Will moving to another shell fix this problem?
Thanks for your help!
--
John J. Ladasky Jr., Ph.D.
Department of Biology
Johns Hopkins University
Baltimore MD 21218
USA
Earth