Skip to content

Instantly share code, notes, and snippets.

@puyo
Created November 29, 2013 04:22
Show Gist options
  • Save puyo/7701547 to your computer and use it in GitHub Desktop.
Save puyo/7701547 to your computer and use it in GitHub Desktop.
A little bit of code to focus the window when running Python Tkinter programs from the command line on OSX.
import sys, os, threading
if sys.platform == 'darwin':
def raise_window():
os.system("""osascript -e 'tell app "Finder" to set frontmost of process "Python" to true'""")
threading.Timer(0.1, raise_window).start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment