Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save allfro/2202591 to your computer and use it in GitHub Desktop.

Select an option

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!')
@pasunboneleve
Copy link

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