Problem with wxPython: wxDialog crashes inside PythonWin

Carlos Ribeiro cribeiro at mail.inet.com.br
Sun May 6 19:53:19 CEST 2001


I'm getting some strange behavior from wxPython. It happens only inside 
PithonWin, when I try to open a wxDialog. The problem is always 
reproducible if I do the following:

- Open the script inside PythonWin
- Run it once, and open the About box Dialog as many times you want. It 
works fine.
- Exit the wxPython application
- Run it again, and try to open the about box.

Then I get this error (that's the brazilian versions of Windows, but you 
should understand it)

-----
PYTHONWIN causou uma falha de página inválida no
módulo PYTHON21.DLL em 0167:1e132ecd.
Registros:
EAX=014ec3a0 CS=0167 EIP=1e132ecd EFLGS=00010202
EBX=00000000 SS=016f ESP=0063e3d0 EBP=00000010
ECX=00000000 DS=016f ESI=00764060 FS=5b37
EDX=00000003 ES=016f EDI=014ec3a0 GS=0000
Bytes em CS:EIP:
81 7d 04 f0 92 18 1e 0f 85 8b 02 00 00 8b 5c 24
Esvaziamento da pilha:
014ec3a0 00000000 01b15570 00000000 00000010 00000112 1e10f60f 014ec3a0 
01b15570 01b304bc 00000000 015635c8 00000000 01b3514c 00000000 00000030
-----

I got the problem first in a script of mine, but I could reproduce it using 
the script that's given in the tutorial on the wxPython website. I'm using 
Python 2.1. Here's the version string. The script is at the end of the email.

PythonWin 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) - see 
'Help/About PythonWin' for further copyright information.


Other related things:

- The error window shown above has a close button, but the application 
keeps stuck. I need to Ctrl-Alt-Del, and then ask Windows to finalize the 
wxPython test application.
- Sometimes I can call PythonWin again right after the bug happens. The 
machine seems to be stable, no other problems happens for any other 
program. But sometimes PythonWin takes ages to reload after this problem.

I'm stuck with this one (that's my first wxPython project). I think it is 
related to some kind of conflict between PythonWin and wxPython. Can 
someone help me?


Carlos Ribeiro


---- this is the test script ----
from wxPython.wx import *

ID_ABOUT = 101
ID_EXIT  = 102

class MyFrame(wxFrame):
     def __init__(self, parent, ID, title):
         wxFrame.__init__(self, parent, ID, title,
                          wxDefaultPosition, wxSize(200, 150))

         self.CreateStatusBar()
         self.SetStatusText("This is the statusbar")
         menu = wxMenu()
         menu.Append(ID_ABOUT, "&About",
                     "More information about this program")
         menu.AppendSeparator()
         menu.Append(ID_EXIT, "E&xit", "Terminate the program")
         menuBar = wxMenuBar()
         menuBar.Append(menu, "&File");
         self.SetMenuBar(menuBar)

         EVT_MENU(self, ID_ABOUT, self.OnAbout)
         EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

     def OnAbout(self, event):
         dlg = wxMessageDialog(self, "This sample program shows off\n"
                               "frames, menus, statusbars, and this\n"
                               "message dialog.",
                               "About Me", wxOK | wxICON_INFORMATION)
         dlg.ShowModal()
         dlg.Destroy()


     def TimeToQuit(self, event):
         self.Close(true)



class MyApp(wxApp):
     def OnInit(self):
         frame = MyFrame(NULL, -1, "Hello from wxPython")
         frame.Show(true)
         self.SetTopWindow(frame)
         return true

app = MyApp(0)
app.MainLoop()






More information about the Python-list mailing list