diff options
author | Guido van Rossum <guido@python.org> | 1994-07-13 12:56:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-07-13 12:56:10 (GMT) |
commit | e7e8d1e15ca620fdfa66ee7903ca1d73e7546596 (patch) | |
tree | 5e3c93345cd53ad2cbd72b4862ee3ea14fbfddea /Demo/tkinter | |
parent | 3284abe75469b00ab83f1899b4b825f211320859 (diff) | |
download | cpython-e7e8d1e15ca620fdfa66ee7903ca1d73e7546596.zip cpython-e7e8d1e15ca620fdfa66ee7903ca1d73e7546596.tar.gz cpython-e7e8d1e15ca620fdfa66ee7903ca1d73e7546596.tar.bz2 |
Change remote operation -- display the widget tree in a listbox and
open relevant dialogs on double click
Diffstat (limited to 'Demo/tkinter')
-rwxr-xr-x | Demo/tkinter/guido/AttrDialog.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Demo/tkinter/guido/AttrDialog.py b/Demo/tkinter/guido/AttrDialog.py index 05da37d..496aae1 100755 --- a/Demo/tkinter/guido/AttrDialog.py +++ b/Demo/tkinter/guido/AttrDialog.py @@ -12,7 +12,6 @@ # -- totally static, though different between PackDialog and WidgetDialog # (but even that could be unified) - from Tkinter import * class Option: @@ -406,9 +405,8 @@ def test(): import sys root = Tk() root.minsize(1, 1) - if sys.argv[2:]: - pd = RemotePackDialog(root, sys.argv[1], sys.argv[2]) - wd = RemoteWidgetDialog(root, sys.argv[1], sys.argv[2]) + if sys.argv[1:]: + remotetest(root, sys.argv[1]) else: frame = Frame(root, {'name': 'frame', Pack: {'expand': 1, 'fill': 'both'}, @@ -426,4 +424,24 @@ def test(): cwd = WidgetDialog(canvas) root.mainloop() +def remotetest(root, app): + from listtree import listtree + list = listtree(root, app) + list.bind('<Any-Double-1>', opendialogs) + list.app = app # Pass it on to handler + +def opendialogs(e): + import string + list = e.widget + sel = list.curselection() + for i in sel: + item = list.get(i) + widget = string.split(item)[0] + RemoteWidgetDialog(list, list.app, widget) + if widget == '.': continue + try: + RemotePackDialog(list, list.app, widget) + except TclError, msg: + print msg + test() |