Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save allfro/2202591 to your computer and use it in GitHub Desktop.
Save allfro/2202591 to your computer and use it in GitHub Desktop.
Tkinter activation workaround
#!/usr/bin/env python
## This script demonstrates a workaround for the Tkinter (Tcl/Tk?) activation
## bug under OS X. More on that here:
from easygui import msgbox
from subprocess import Popen
from Tkinter import Tk
## Bring easygui to foreground
# First we need to create a window to activate the Python.app
Tk().destroy()
# Next we activate it
Popen(['osascript', '-e', 'tell application "Python" to activate'])
## Start using Tkinter/EasyGUI/Grun with the interface in the Foreground
msgbox('Hello world!')
@dmvianna
Copy link

dmvianna commented May 5, 2012

Works for me on OSX 10.7.3 Lion. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment