ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxPython-users
wxPython-users
[wxPython-users] Newbie -- how can "Hello, world" crash?
by JOHN LADASKY LADASKY other posts by this author
Mar 23 2003 7:18PM messages near this date
Re: [wxPython-users] Controlling threads | Re: [wxPython-users] Newbie -- how can "Hello, world" crash?
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



---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@[...].org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
Thread:
JOHN LADASKY LADASKY
Patrick K. O'Brien
Chris Munchenberg
Werner F. Bruhin
Kevin Altis
Magnus Lycka
Donnal Walter

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved