Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion blessclient/tokengui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import platform
import os
import subprocess
from six.moves.tkinter import Tk, Label, Entry, Button, ACTIVE, W, mainloop


Expand Down Expand Up @@ -35,7 +36,10 @@ def doGUI(self, hostname=None):

if platform.system() == 'Darwin':
# Hack to get the GUI dialog focused in OSX
os.system('/usr/bin/osascript -e \'tell app "Finder" to set frontmost of process "python" to true\'')
# https://stackoverflow.com/questions/1892339/how-to-make-a-tkinter-window-jump-to-the-front/37235492#37235492
tmpl = 'tell application "System Events" to set frontmost of every process whose unix id is {} to true'
script = tmpl.format(os.getpid())
subprocess.check_call(['/usr/bin/osascript', '-e', script])

mainloop()

Expand Down