File: pyedit-products/unzipped/PP4E/echogui.py

# example: echogui.py a\ bc "-123" => ['echogui.py', 'a bc', '-123'] on unix

import sys
from tkinter import *
root = Tk()

# ok if missing script args on mac 'open', blocking 'system' on Windows  
mode = '' if len(sys.argv) == 1 else sys.argv[-1]
args = str(sys.argv if not mode else sys.argv[:-1])
if mode == '':
    mode = '(no mode arg)'

Label(root, text=mode).pack()
Label(root, text='argv=' + args).pack()
Button(root, text='OK', command=sys.exit).pack()
root.mainloop()



[Home page] Books Code Blog Python Author Train Find ©M.Lutz