I have a simple Python script that loads a GUI (created with Tkinter) when run. I used py2app to convert the Python script into a double-click app for OSX. When the app is clicked, Python executes the script. However, Python (and the GUI) load minimized. The user has to click on the Python icon in the tray in order to bring the GUI into the foreground.
I have tried adding lift() to the main Tkiner window but it doesn't seem to have any effect (I've tried similar methods with no success in bringing the window to the foreground). After the app is double-clicked, it is hard for users to tell what's going on if the GUI doesn't pop-up (especially if they are expecting some kind interface to appear). I am running Lion and didn't have this problem on Leapord.
Any help would be greatly appreciated.
Thanks.
I just faced the same issue and found the general cause. The problem with all the published workarounds is that they either don't work for a py2app-built executable (the '-topmost' workaround doesn't) or have serious side effects (the iconify/deiconify works but causes all future modal windows from the app to stop being dismissible, including tkMessageBox and tkFileDialog).
The problem is caused by the argv_emulation of py2app, which is enabled by default. That option puts some OSX-specific Carbon event code in the boot loader of the app, which can be found at dist/appname/Contents/Resources/__ boot __.py of your built application bundle. I don't need the argv_emulation so for now I just disabled the feature by changing argv_emulation to False in the OPTIONS dictionary of the setup.py built by py2applet:
OPTIONS = { 'argv_emulation' : False }
Python Tkinter GUI Always loads minimized