summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-06-20 08:11:36 (GMT)
committerGuido van Rossum <guido@python.org>1994-06-20 08:11:36 (GMT)
commit3c1d087b1946954f141370037f706cc19a524a45 (patch)
tree3337f3b7f411b5233682ae228b647c918b210805
parent1846882254324ac5eb0a96df493c7ab1eabd866e (diff)
downloadcpython-3c1d087b1946954f141370037f706cc19a524a45.zip
cpython-3c1d087b1946954f141370037f706cc19a524a45.tar.gz
cpython-3c1d087b1946954f141370037f706cc19a524a45.tar.bz2
Adapted to new Tkinter.py.
-rwxr-xr-xDemo/tkinter/guido/dialog.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/Demo/tkinter/guido/dialog.py b/Demo/tkinter/guido/dialog.py
index 31f5340..621646a 100755
--- a/Demo/tkinter/guido/dialog.py
+++ b/Demo/tkinter/guido/dialog.py
@@ -12,7 +12,6 @@ def dialog(master, title, text, bitmap, default, *args):
# and bottom parts.
w = Toplevel(master, {'class': 'Dialog'})
- w.tk.call('global', 'button')
w.title(title)
w.iconname('Dialog')
@@ -47,7 +46,7 @@ def dialog(master, title, text, bitmap, default, *args):
bd = Frame(bot, {'relief': 'sunken', 'bd': 1,
Pack: {'side': 'left', 'expand': 1,
'padx': '3m', 'pady': '2m'}})
- w.tk.call('raise', b)
+ b.lift()
b.pack ({'in': bd, 'side': 'left',
'padx': '2m', 'pady': '2m',
'ipadx': '2m', 'ipady': '1m'})
@@ -62,21 +61,21 @@ def dialog(master, title, text, bitmap, default, *args):
if default >= 0:
w.bind('<Return>',
- lambda b=buttons[default], i=default:
- (b.cmd('flash'),
- b.tk.call('set', 'button', i)))
+ lambda e, b=buttons[default], i=default:
+ (b.flash(),
+ b.setvar('button', i)))
- oldFocus = w.tk.call('focus')
- w.tk.call('grab', 'set', w)
- w.tk.call('focus', w)
+ oldFocus = w.tk.call('focus') # XXX
+ w.grab_set()
+ w.focus()
# 5. Wait for the user to respond, then restore the focus
# and return the index of the selected button.
- w.tk.call('tkwait', 'variable', 'button')
- w.tk.call('destroy', w)
- w.tk.call('focus', oldFocus)
- return w.tk.call('set', 'button')
+ w.waitvar('button')
+ w.destroy()
+ w.tk.call('focus', oldFocus) # XXX
+ return w.getint(w.getvar('button'))
# The rest is the test program.
@@ -113,7 +112,7 @@ def test():
{'text': 'Exit',
'command': 'exit',
Pack: {'fill' : 'both'}})
- mainWidget.tk.mainloop()
+ mainWidget.mainloop()
if __name__ == '__main__':
test()