I'm having a little trouble running wxPython. I did a little Googling and didn't find a whole lot though.

Here is a sample of what I'm trying to run...

import wx
app = wx.PySimpleApp()
frame = wx.Frame(None, wx.ID_ANY, "Hello World")
frame.Show(True)
app.MainLoop()

This code is straight from the tutorial provided by wxPython, so I'd expect this to work... however it doesn't.

In the command line I'll type "python hello-world.py" and it'll load the window, but after a couple seconds I get the wonderful "python.exe has stopped working" error.

Is there anyone else who has had this issue and knows how to fix it? I'd like to stick with learning wxPython as it seems to be the best choice... but if it won't work on my machine, I'll have to change.

Recommended Answers

All 15 Replies

Don't use python 2.6

Or if you use python 2.6, use the manifest patch included in the latest wxPython distribution. There is a fix for this issue that should come with the next release, but for now you have to use the manifest patch (see the release notes).

And as for this:

I'd like to stick with learning wxPython as it seems to be the best choice...

No, it's not.

No, it's not.

Mind explaining why?

wxPython works fine with Python25 on my Vista machine.

To me wxPython fits the bill, it's easy to install, it's many widgets are powerful, and programs are easy to distribute using py2exe.

On Windows pyGTK is scattered (GTK, pyGTK, pyCairo, pyGobject) and difficult to install, and the programs you write with it are even more difficult to distribute. Also, GTK and pyGTK versions have to match!

pyQT4 is simpler to install, but has very few good examples on the internet.

Unix users are more familiar with GTK/pyGTK and QT/pyQT, even though some Linux friends tell me that wxPython programs work well.

wxPython is bloated, disorganized. There's a lot of fat in there that needs trimming. Additionally, there are some ways of doing things that shock/disgust me as a python programmer (this is one thing I can never understand; why do python programmers act as though wx is the holy grail of gui programming when it is so disgustingly non-pythonic?).

There are some sneaky annoying little bugs that hide away and then sneak up on you as soon as you try to do anything just a little out of the ordinary. wx.Panel is a repeat offender.

The UI you get from it is always either ugly, bland or disgustingly non-standard (sometimes a combination). Sure it does look "native" when using only the core modules, but even then the UI feels kind of old or dated.

The only reason I would consider using wxPython is if I want to do a cross platform project, one of its few strengths. But then I would only consider it for a moment, and then get on with my life.

Of course I mean no offense to the wxPython devs; they seem like nice enough people. wxPython gets a lot of its bloated, dated and non-pythonic feel from wxWidgets itself, although it wouldn't hurt for them to have tighter control on the quality of code they let into the wx.lib package.

IMHO, if speculation is correct and pyQT does release an LGPL version, then wxPython may slowly fade away. And I won't be bothered one bit.

Thanks for the details Scru.

So for open source projects you suggest pyQT it sounds like. I'll look into them and see how I like it.

Thanks for the suggestions.

...
On Windows pyGTK is scattered (GTK, pyGTK, pyCairo, pyGobject) and difficult to install, and the programs you write with it are even more difficult to distribute. Also, GTK and pyGTK versions have to match!
...

Yeah, it's much worse than wxPython on Windows. When used for projects that are only used in GNOME it's alright, heck, superb (especially with glade; and if anybody mentions wxGlade or that boaconstructor thing I will come to their doorstep and scream. Those are not serious packages at all).

Just looked up some install file sizes:

wxPython2.8-win32-unicode-2.8.9.1-py25.exe comes in at 9.5MB

PyQt-Py2.5-gpl-4.4.3-1.exe comes in at 23.5MB

pygtk-setup.exe is above 18MB

That's not a fair comparison. PyQT comes with a lot of stuff that are not a part of the toolkit itself; QT designer being one of them. Also, pyQT doesn't suffer from the same disorganization. And at the very least, pyQT's isn't redundant (care to count how many Notebook flavors are in the core wx package, before even uncovering those hidden away in the wx.lib package)?

Now don't get me wrong. It may seem like it but I don't hate wx. If someone wants to use wx I don't usually try to deter them. It just really gets my goat when people say it's the best choice for GUI programming when I would think it's so obvious that it is not.

Maybe if they said it was the best choice for writing cross-platform non-gpled (which is a valid enough reason on its own) software in one go, then yes, I would agree.

So what are the chances of starting a pyQT or pyGTK thread like the wxPython thread we have... sticky and all! I'd love to see some examples of either pyQT or pyGTK as I've no experience with either...

Thoughts?

So what are the chances of starting a pyQT or pyGTK thread like the wxPython thread we have... sticky and all! I'd love to see some examples of either pyQT or pyGTK as I've no experience with either...

Thoughts?

Yeah i would like to see that as well. And if it is so complicated to install as Vega says then have things like how to install it on different OS's.
But im all for it. :)

I like to keep the number of stickies to a minimum, so they won't start to clutter the top of the Python forum page. How about a sticky on "Python GUI Programming" or such? It should have an emphasis on comparing the various GUI toolkits, showing example code and solutions to problems.

In my experience, a good collection of code templates is gold!

Your thoughts?

Sounds good to me.

Sounds good to me.

Thanks scru!

So I will rely on you to give us a couple of simple pyQT code samples/templates on creating a form, bind a button to an action, working with a list, showing an image, drawing some shapes and saving them. Simple stuff initially, to get folks interested in building something more complex.

Will you help us?

Sure I can help with that. I can even contribute some straight win32 code for the brave ones, or some pyGTK code for those on GNOME.

Sure I can help with that. I can even contribute some straight win32 code for the brave ones, or some pyGTK code for those on GNOME.

Great! The "Python GUI Programming" sticky has been created. I hope it has a good start!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.