1

Recently I installed wxPython to do some works under Windows. Most of the time I work in Linux so I have a little experience here.
with python.exe interpreter, I just do 2 line of code
import wx
tmp=wx.App(False)

Then the interpreter crashed with Windows error reporting.
I tried both python 2.7.1 and 2.6.6 with wxPython 2.8.11, all come from their main website, still no luck.
Is there something I must do after install Python in Windows ? I can see that python install just fine and can do some basic job, wxPython library can be load, but can't call wx.App

ntcong
  • 800
  • 2
  • 7
  • 16
  • What version of Windows? 32-bit or 64-bit? – Velociraptors Dec 06 '10 at 18:11
  • Something is clearly very wrong. I'd recommend uninstall and reinstall, but it could be something more specific to your machine, and not simply a misconfiguration of the install. – jgritty Dec 06 '10 at 18:22
  • I think it's the problem with the dll, maybe python 2.7.1 and wxPython 2.8.11 does not compile with the same C compiler I guest. In the meantime I think I will switch to PyQt – ntcong Dec 06 '10 at 18:30

3 Answers3

1

In case like me somebody will stumble into this question like I did. Recently installed wxpython on two machines, windows 7 and XP. Testing the sample code in simple.py (provided with the wxpython docs-demos installer), running from a python console, I had the following problem on both machines: First import ok, but when I did a reload of the module, python crash.

I added this line in the end of the simple.py file: del app

and that fixed the problem on windows 7 and tomorrow I try it on the XP machine.

Same solution fitted for the XP machine. So, reloading an un-edited module with a reference to a wx.App with a closed gui seem not to be feasable. Killing the reference with a del statement was enough to solve the problem.

Tompa
  • 5,131
  • 2
  • 13
  • 13
1

If you are running that in IDLE, then that is your problem. IDLE and wx don't get along very well because you basically end up with two mainloops fighting each other. Try putting it in a file and then run the file from the command line:

c:\python27\python.exe myPyFile.py

That should work just fine. Otherwise, download the correct wxPython for your Python and OS (32/64 bit), uninstall the current one and install the new one. I've been using wxPython on Windows XP, Vista and 7 with no problems like this.

Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88
0

I searched for a while and found that this is the problem with wxPython and Python >2.5. Tried many fix with manyfest file but no luck, so I think switch to PyQt is the only solution now.

ntcong
  • 800
  • 2
  • 7
  • 16