1 import sys
 2 from Tkinter import *
 3 popuper = (len(sys.argv) > 1)
 4 
 5 def dialog():
 6     win=Toplevel()
 7     Label(win, text='This is a Text').pack()
 8     Button(win, text='Now click Me',command=win.destroy).pack()
 9     if popupper:
10         win.focus_set()
11         win.grab_set()
12         win.wait_window()
13     print('You better obey me...')
14 
15 root = Tk()
16 Button(root, text='Click me',command=dialog).pack()
17 root.mainloop()