PDA

View Full Version : python wxWidgets application problem



peredur
March 21st, 2013, 02:06 AM
I'm trying to run the text editor example application from:

http://wiki.wxpython.org/Getting%20Started

(Specifically the first example with a menu attached)

Ubuntu 12.04, Python 2.7

Having pasted the code into IDLE, saved the file and then run the application from within IDLE, the frame appears, but the menu does not. The application does not run at all outside of IDLE.

Any suggestions greatly appreciated.

Best regards


PAE

peredur
March 21st, 2013, 10:52 AM
Well, I sorted two out of the three problems. Both were the results of my own stupidity.

The menu doesn't show because it's the Unity interface and so the menu doesn't appear in the application window but rather at the top of the desktop. I really should have thought of that earlier but tiredness took its toll, I'm afraid.

The application didn't run from the command line because I'd omitted the shebang line. Again, it must be tiredness that's to blame for that.

But I still have the problem of not being able to re-run the application in IDLE. If anyone does know why that should be the case I'd be glad to hear it, but it sounds like an IDLE problem, so I'll look for an IDLE forum and post there.

Many thanks


PAE

peredur
March 21st, 2013, 11:24 AM
Continuing this conversation I'm having with myself - for which I apologise...

The way the IDLE process is started is responsible for the fact that I can't run programs twice in the same shell in IDLE. Apparently the launcher starts IDLE using the -n option which has this undesirable side effect. Starting IDLE from the command line without the -n option fixes the problem, but is annoying.

Does anyone know how to make the Unity launcher start IDLE 'properly' (i.e. without the -n option)?

Cheers


PAE

r-senior
March 22nd, 2013, 08:41 AM
You could edit the .desktop file. The usual way is to copy it from /usr/share/applications to ~/.local/share/applications and edit your local copy which takes precedence over the global one. Look for the Exec line. I'm assuming it would be idle.desktop.

peredur
March 22nd, 2013, 11:22 AM
Many thanks. Yep. That did it. Although, actually, I had achieved it in a roundabout way before getting your reply.

Having failed to find out how to change the command in Unity, I started an LXDE session and did it there - where all you have to do is right-clickk on the menu item. Back in Unity, the change persisted, so job done. But your way would have been better, had I known about it.

Pretty much all the main Linux desktops that are GNOME or KDE-based seem to be moving in the direction of making trivial changes like these hard to do, it appears to me. I think that's a mistake.

Thanks for your help.

r-senior
March 22nd, 2013, 12:31 PM
I agree that it's probably harder than it should be. For reference, here are the docs that describe the process using the editor method and alacarte (which is what I suspect your LXDE session did):

https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles

peredur
March 22nd, 2013, 12:42 PM
Thanks. Much appreciated.