GIF89a;
EcchiShell v1.0
/
/
usr/
lib64/
lib64/
lib64/
python2.7/
Demo/
, if there's a default,
# set a grab, and claim the focus too.
if default >= 0:
w.bind('',
lambda e, b=buttons[default], v=var, i=default:
(b.flash(),
v.set(i)))
oldFocus = w.focus_get()
w.grab_set()
w.focus_set()
# 5. Wait for the user to respond, then restore the focus
# and return the index of the selected button.
w.waitvar(var)
w.destroy()
if oldFocus: oldFocus.focus_set()
return var.get()
# The rest is the test program.
def go():
i = dialog(mainWidget,
'Not Responding',
"The file server isn't responding right now; "
"I'll keep trying.",
'',
-1,
'OK')
print 'pressed button', i
i = dialog(mainWidget,
'File Modified',
'File "tcl.h" has been modified since '
'the last time it was saved. '
'Do you want to save it before exiting the application?',
'warning',
0,
'Save File',
'Discard Changes',
'Return To Editor')
print 'pressed button', i
def test():
import sys
global mainWidget
mainWidget = Frame()
Pack.config(mainWidget)
start = Button(mainWidget, text='Press Here To Start', command=go)
start.pack()
endit = Button(mainWidget, text="Exit", command=sys.exit)
endit.pack(fill=BOTH)
mainWidget.mainloop()
if __name__ == '__main__':
test()