]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Change remote operation -- display the widget tree in a listbox and
authorGuido van Rossum <guido@python.org>
Wed, 13 Jul 1994 12:56:10 +0000 (12:56 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 13 Jul 1994 12:56:10 +0000 (12:56 +0000)
open relevant dialogs on double click

Demo/tkinter/guido/AttrDialog.py

index 05da37d52b9d2a0c7c0ecfe2e2a3dc94658db2f8..496aae1c9cba51ce6f716d97a0b088587d291ec4 100755 (executable)
@@ -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()