diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
commit | 182b5aca27d376b08a2904bed42b751496f932f3 (patch) | |
tree | df13115820dbc879c0fe2eae488c9f8c0215a7da /Demo/tix/samples | |
parent | e6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff) | |
download | cpython-182b5aca27d376b08a2904bed42b751496f932f3.zip cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2 |
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Demo/tix/samples')
-rwxr-xr-x | Demo/tix/samples/Balloon.py | 2 | ||||
-rwxr-xr-x | Demo/tix/samples/BtnBox.py | 8 | ||||
-rwxr-xr-x | Demo/tix/samples/CmpImg.py | 37 | ||||
-rwxr-xr-x | Demo/tix/samples/ComboBox.py | 20 | ||||
-rwxr-xr-x | Demo/tix/samples/Control.py | 16 | ||||
-rwxr-xr-x | Demo/tix/samples/DirList.py | 17 | ||||
-rwxr-xr-x | Demo/tix/samples/DirTree.py | 11 | ||||
-rwxr-xr-x | Demo/tix/samples/NoteBook.py | 50 | ||||
-rwxr-xr-x | Demo/tix/samples/OptMenu.py | 24 | ||||
-rwxr-xr-x | Demo/tix/samples/PanedWin.py | 2 | ||||
-rwxr-xr-x | Demo/tix/samples/PopMenu.py | 10 | ||||
-rwxr-xr-x | Demo/tix/samples/SHList1.py | 21 | ||||
-rwxr-xr-x | Demo/tix/samples/SHList2.py | 41 | ||||
-rwxr-xr-x | Demo/tix/samples/Tree.py | 44 |
14 files changed, 149 insertions, 154 deletions
diff --git a/Demo/tix/samples/Balloon.py b/Demo/tix/samples/Balloon.py index 825ae6a..2295905 100755 --- a/Demo/tix/samples/Balloon.py +++ b/Demo/tix/samples/Balloon.py @@ -17,7 +17,7 @@ import Tix -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): balloon = DemoBalloon(root) diff --git a/Demo/tix/samples/BtnBox.py b/Demo/tix/samples/BtnBox.py index 57d02df..af2a2a8 100755 --- a/Demo/tix/samples/BtnBox.py +++ b/Demo/tix/samples/BtnBox.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -21,7 +21,7 @@ def RunSample(w): # Create the label on the top of the dialog box # top = Tix.Label(w, padx=20, pady=10, bd=1, relief=Tix.RAISED, - anchor=Tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget') + anchor=Tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget') # Create the button box and add a few buttons in it. Set the # -width of all the buttons to the same value so that they @@ -32,9 +32,9 @@ def RunSample(w): # box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL) box.add('ok', text='OK', underline=0, width=5, - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) box.add('close', text='Cancel', underline=0, width=5, - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) box.pack(side=Tix.BOTTOM, fill=Tix.X) top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) diff --git a/Demo/tix/samples/CmpImg.py b/Demo/tix/samples/CmpImg.py index 4e08df7..4720a10 100755 --- a/Demo/tix/samples/CmpImg.py +++ b/Demo/tix/samples/CmpImg.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -22,13 +22,13 @@ static char * netw_xpm[] = { /* width height ncolors chars_per_pixel */ "32 32 7 1", /* colors */ -" s None c None", -". c #000000000000", -"X c white", -"o c #c000c000c000", -"O c #404040", -"+ c blue", -"@ c red", +" s None c None", +". c #000000000000", +"X c white", +"o c #c000c000c000", +"O c #404040", +"+ c blue", +"@ c red", /* pixels */ " ", " .............. ", @@ -69,11 +69,11 @@ static char * drivea_xpm[] = { /* width height ncolors chars_per_pixel */ "32 32 5 1", /* colors */ -" s None c None", -". c #000000000000", -"X c white", -"o c #c000c000c000", -"O c #800080008000", +" s None c None", +". c #000000000000", +"X c white", +"o c #c000c000c000", +"O c #800080008000", /* pixels */ " ", " ", @@ -146,10 +146,10 @@ static unsigned char drivea_bits[] = { def RunSample(w): w.img0 = Tix.Image('pixmap', data=network_pixmap) if not w.img0: - w.img0 = Tix.Image('bitmap', data=network_bitmap) + w.img0 = Tix.Image('bitmap', data=network_bitmap) w.img1 = Tix.Image('pixmap', data=hard_disk_pixmap) if not w.img0: - w.img1 = Tix.Image('bitmap', data=hard_disk_bitmap) + w.img1 = Tix.Image('bitmap', data=hard_disk_bitmap) hdd = Tix.Button(w, padx=4, pady=1, width=120) net = Tix.Button(w, padx=4, pady=1, width=120) @@ -163,7 +163,7 @@ def RunSample(w): w.hdd_img = Tix.Image('compound', window=hdd) w.hdd_img.tk.call(str(w.hdd_img), 'add', 'line') w.hdd_img.tk.call(str(w.hdd_img), 'add', 'text', '-text', 'Hard Disk', - '-underline', '0') + '-underline', '0') w.hdd_img.tk.call(str(w.hdd_img), 'add', 'space', '-width', '7') w.hdd_img.tk.call(str(w.hdd_img), 'add', 'image', '-image', w.img1) @@ -175,7 +175,7 @@ def RunSample(w): w.net_img = Tix.Image('compound', window=net) w.net_img.tk.call(str(w.net_img), 'add', 'line') w.net_img.tk.call(str(w.net_img), 'add', 'text', '-text', 'Network', - '-underline', '0') + '-underline', '0') w.net_img.tk.call(str(w.net_img), 'add', 'space', '-width', '7') w.net_img.tk.call(str(w.net_img), 'add', 'image', '-image', w.img0) @@ -184,7 +184,7 @@ def RunSample(w): net['image'] = w.net_img close = Tix.Button(w, pady=1, text='Close', - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) hdd.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1) net.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1) @@ -194,4 +194,3 @@ if __name__ == '__main__': root = Tix.Tk() RunSample(root) root.mainloop() - diff --git a/Demo/tix/samples/ComboBox.py b/Demo/tix/samples/ComboBox.py index afecea4..9140987 100755 --- a/Demo/tix/samples/ComboBox.py +++ b/Demo/tix/samples/ComboBox.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -27,25 +27,25 @@ def RunSample(w): # to invent new months? # # [Hint] The -options switch sets the options of the subwidgets. - # [Hint] We set the label.width subwidget option of both comboboxes to + # [Hint] We set the label.width subwidget option of both comboboxes to # be 10 so that their labels appear to be aligned. # a = Tix.ComboBox(top, label="Month: ", dropdown=1, - command=select_month, editable=0, variable=demo_month, - options='listbox.height 6 label.width 10 label.anchor e') + command=select_month, editable=0, variable=demo_month, + options='listbox.height 6 label.width 10 label.anchor e') # $w.top.b is a non-drop-down combo box. It is not editable: we provide # four choices for the user, but he can enter an alternative year if he # wants to. # # [Hint] Use the padY and anchor options of the label subwidget to - # align the label with the entry subwidget. + # align the label with the entry subwidget. # [Hint] Notice that you should use padY (the NAME of the option) and not # pady (the SWITCH of the option). # b = Tix.ComboBox(top, label="Year: ", dropdown=0, - command=select_year, editable=1, variable=demo_year, - options='listbox.height 4 label.padY 5 label.width 10 label.anchor ne') + command=select_year, editable=1, variable=demo_year, + options='listbox.height 4 label.padY 5 label.width 10 label.anchor ne') a.pack(side=Tix.TOP, anchor=Tix.W) b.pack(side=Tix.TOP, anchor=Tix.W) @@ -70,7 +70,7 @@ def RunSample(w): b.insert(Tix.END, '1996') # Use "tixSetSilent" to set the values of the combo box if you - # don't want your -command procedures (cbx:select_month and + # don't want your -command procedures (cbx:select_month and # cbx:select_year) to be called. # a.set_silent('January') @@ -78,9 +78,9 @@ def RunSample(w): box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL) box.add('ok', text='Ok', underline=0, width=6, - command=lambda w=w: ok_command(w)) + command=lambda w=w: ok_command(w)) box.add('cancel', text='Cancel', underline=0, width=6, - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) box.pack(side=Tix.BOTTOM, fill=Tix.X) top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) diff --git a/Demo/tix/samples/Control.py b/Demo/tix/samples/Control.py index e85ee84..3a344c1 100755 --- a/Demo/tix/samples/Control.py +++ b/Demo/tix/samples/Control.py @@ -20,7 +20,7 @@ import Tix -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): control = DemoControl(root) @@ -46,7 +46,7 @@ class DemoControl: # $w.top.a allows only integer values # # [Hint] The -options switch sets the options of the subwidgets. - # [Hint] We set the label.width subwidget option of the Controls to + # [Hint] We set the label.width subwidget option of the Controls to # be 16 so that their labels appear to be aligned. # a = Tix.Control(top, label='Number of Engines: ', integer=1, @@ -83,7 +83,7 @@ class DemoControl: def okcmd (self): # tixDemo:Status "Selected %d of %s engines each of thrust %d", (demo_num_engines.get(), demo_maker.get(), demo_thrust.get()) self.quitcmd() - + def quitcmd (self): self.exit = 0 @@ -100,9 +100,9 @@ def adjust_maker(w, inc): i = maker_list.index(demo_maker.get()) i = i + inc if i >= len(maker_list): - i = 0 + i = 0 elif i < 0: - i = len(maker_list) - 1 + i = len(maker_list) - 1 # In Tcl/Tix we should return the string maker_list[i]. We can't # do that in Tkinter so we set the global variable. (This works). @@ -110,10 +110,10 @@ def adjust_maker(w, inc): def validate_maker(w): try: - i = maker_list.index(demo_maker.get()) + i = maker_list.index(demo_maker.get()) except ValueError: - # Works here though. Why ? Beats me. - return maker_list[0] + # Works here though. Why ? Beats me. + return maker_list[0] # Works here though. Why ? Beats me. return maker_list[i] diff --git a/Demo/tix/samples/DirList.py b/Demo/tix/samples/DirList.py index 8d7536c..5fd8c0d 100755 --- a/Demo/tix/samples/DirList.py +++ b/Demo/tix/samples/DirList.py @@ -1,6 +1,6 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # -# $Id$ +# $Id$ # # Tix Demostration Program # @@ -19,21 +19,21 @@ import Tix, os, copy from Tkconstants import * -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): dirlist = DemoDirList(root) dirlist.mainloop() dirlist.destroy() - + class DemoDirList: def __init__(self, w): self.root = w self.exit = -1 - + z = w.winfo_toplevel() z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - + # Create the tixDirList and the tixLabelEntry widgets on the on the top # of the dialog box @@ -48,14 +48,14 @@ class DemoDirList: # top.dir = Tix.DirList(top) top.dir.hlist['width'] = 40 - + # When the user presses the ".." button, the selected directory # is "transferred" into the entry widget # top.btn = Tix.Button(top, text = " >> ", pady = 0) # We use a LabelEntry to hold the installation directory. The user - # can choose from the DirList widget, or he can type in the directory + # can choose from the DirList widget, or he can type in the directory # manually # top.ent = Tix.LabelEntry(top, label="Installation Directory:", @@ -64,7 +64,7 @@ class DemoDirList: entry.width 40 label.anchor w ''') - + font = self.root.tk.eval('tix option get fixed_font') # font = self.root.master.tix_option_get('fixed_font') top.ent.entry['font'] = font @@ -129,4 +129,3 @@ if __name__== '__main__' : for line in traceback.format_exception(t,v,tb): text = text + line + '\n' d = tkMessageBox.showerror ( 'Tix Demo Error', text) - diff --git a/Demo/tix/samples/DirTree.py b/Demo/tix/samples/DirTree.py index d007a2b..2e4fe0b 100755 --- a/Demo/tix/samples/DirTree.py +++ b/Demo/tix/samples/DirTree.py @@ -1,6 +1,6 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # -# $Id$ +# $Id$ # # Tix Demostration Program # @@ -19,7 +19,7 @@ import Tix, os, copy from Tkconstants import * -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): dirtree = DemoDirTree(root) @@ -30,7 +30,7 @@ class DemoDirTree: def __init__(self, w): self.root = w self.exit = -1 - + z = w.winfo_toplevel() z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) @@ -48,14 +48,14 @@ class DemoDirTree: # top.dir = Tix.DirTree(top) top.dir.hlist['width'] = 40 - + # When the user presses the ".." button, the selected directory # is "transferred" into the entry widget # top.btn = Tix.Button(top, text = " >> ", pady = 0) # We use a LabelEntry to hold the installation directory. The user - # can choose from the DirTree widget, or he can type in the directory + # can choose from the DirTree widget, or he can type in the directory # manually # top.ent = Tix.LabelEntry(top, label="Installation Directory:", @@ -115,4 +115,3 @@ class DemoDirTree: if __name__== '__main__' : root=Tix.Tk() RunSample(root) - diff --git a/Demo/tix/samples/NoteBook.py b/Demo/tix/samples/NoteBook.py index abf3bfd..1e0da3e 100755 --- a/Demo/tix/samples/NoteBook.py +++ b/Demo/tix/samples/NoteBook.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -23,9 +23,9 @@ def RunSample(w): # notebook, so that they are well-aligned on the screen. prefix = Tix.OptionName(w) if prefix: - prefix = '*'+prefix + prefix = '*'+prefix else: - prefix = '' + prefix = '' w.option_add(prefix+'*TixControl*entry.width', 10) w.option_add(prefix+'*TixControl*label.width', 18) w.option_add(prefix+'*TixControl*label.anchor', Tix.E) @@ -37,14 +37,14 @@ def RunSample(w): nb = Tix.NoteBook(w, name='nb', ipadx=6, ipady=6) nb['bg'] = 'gray' nb.nbframe['backpagecolor'] = 'gray' - + # Create the two tabs on the notebook. The -underline option # puts a underline on the first character of the labels of the tabs. # Keyboard accelerators will be defined automatically according - # to the underlined character. + # to the underlined character. nb.add('hard_disk', label="Hard Disk", underline=0) nb.add('network', label="Network", underline=0) - + nb.pack(expand=1, fill=Tix.BOTH, padx=5, pady=5 ,side=Tix.TOP) #---------------------------------------- @@ -56,62 +56,62 @@ def RunSample(w): tab=nb.hard_disk f = Tix.Frame(tab) common = Tix.Frame(tab) - + f.pack(side=Tix.LEFT, padx=2, pady=2, fill=Tix.BOTH, expand=1) common.pack(side=Tix.RIGHT, padx=2, fill=Tix.Y) - + a = Tix.Control(f, value=12, label='Access time: ') w = Tix.Control(f, value=400, label='Write Throughput: ') r = Tix.Control(f, value=400, label='Read Throughput: ') c = Tix.Control(f, value=1021, label='Capacity: ') - + a.pack(side=Tix.TOP, padx=20, pady=2) w.pack(side=Tix.TOP, padx=20, pady=2) r.pack(side=Tix.TOP, padx=20, pady=2) c.pack(side=Tix.TOP, padx=20, pady=2) - + # Create the common buttons createCommonButtons(common) - + #---------------------------------------- - # Create the second page + # Create the second page #---------------------------------------- - + tab = nb.network f = Tix.Frame(tab) common = Tix.Frame(tab) - + f.pack(side=Tix.LEFT, padx=2, pady=2, fill=Tix.BOTH, expand=1) common.pack(side=Tix.RIGHT, padx=2, fill=Tix.Y) - + a = Tix.Control(f, value=12, label='Access time: ') w = Tix.Control(f, value=400, label='Write Throughput: ') r = Tix.Control(f, value=400, label='Read Throughput: ') c = Tix.Control(f, value=1021, label='Capacity: ') u = Tix.Control(f, value=10, label='Users: ') - + a.pack(side=Tix.TOP, padx=20, pady=2) w.pack(side=Tix.TOP, padx=20, pady=2) r.pack(side=Tix.TOP, padx=20, pady=2) c.pack(side=Tix.TOP, padx=20, pady=2) u.pack(side=Tix.TOP, padx=20, pady=2) - + createCommonButtons(common) - + def doDestroy(): global root root.destroy() def createCommonButtons(master): - ok = Tix.Button(master, name='ok', text='OK', width=6, - command=doDestroy) - cancel = Tix.Button(master, name='cancel', - text='Cancel', width=6, - command=doDestroy) - + ok = Tix.Button(master, name='ok', text='OK', width=6, + command=doDestroy) + cancel = Tix.Button(master, name='cancel', + text='Cancel', width=6, + command=doDestroy) + ok.pack(side=Tix.TOP, padx=2, pady=2) - cancel.pack(side=Tix.TOP, padx=2, pady=2) + cancel.pack(side=Tix.TOP, padx=2, pady=2) if __name__ == '__main__': root = Tix.Tk() diff --git a/Demo/tix/samples/OptMenu.py b/Demo/tix/samples/OptMenu.py index ecb0c86..1d39420 100755 --- a/Demo/tix/samples/OptMenu.py +++ b/Demo/tix/samples/OptMenu.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -16,7 +16,7 @@ import Tix options = {'text':'Plain Text', 'post':'PostScript', 'html':'HTML', - 'tex':'LaTeX', 'rtf':'Rich Text Format'} + 'tex':'LaTeX', 'rtf':'Rich Text Format'} def RunSample(w): global demo_opt_from, demo_opt_to @@ -27,22 +27,22 @@ def RunSample(w): top = Tix.Frame(w, bd=1, relief=Tix.RAISED) from_file = Tix.OptionMenu(top, label="From File Format : ", - variable=demo_opt_from, - options = 'label.width 19 label.anchor e menubutton.width 15') + variable=demo_opt_from, + options = 'label.width 19 label.anchor e menubutton.width 15') to_file = Tix.OptionMenu(top, label="To File Format : ", - variable=demo_opt_to, - options='label.width 19 label.anchor e menubutton.width 15') + variable=demo_opt_to, + options='label.width 19 label.anchor e menubutton.width 15') # Add the available options to the two OptionMenu widgets # # [Hint] You have to add the options first before you set the - # global variables "demo_opt_from" and "demo_opt_to". Otherwise - # the OptionMenu widget will complain about "unknown options"! + # global variables "demo_opt_from" and "demo_opt_to". Otherwise + # the OptionMenu widget will complain about "unknown options"! # for opt in options.keys(): - from_file.add_command(opt, label=options[opt]) - to_file.add_command(opt, label=options[opt]) + from_file.add_command(opt, label=options[opt]) + to_file.add_command(opt, label=options[opt]) demo_opt_from.set('html') demo_opt_to.set('post') @@ -52,9 +52,9 @@ def RunSample(w): box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL) box.add('ok', text='Ok', underline=0, width=6, - command=lambda w=w: ok_command(w)) + command=lambda w=w: ok_command(w)) box.add('cancel', text='Cancel', underline=0, width=6, - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) box.pack(side=Tix.BOTTOM, fill=Tix.X) top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) diff --git a/Demo/tix/samples/PanedWin.py b/Demo/tix/samples/PanedWin.py index bfe10c2..3efc731 100755 --- a/Demo/tix/samples/PanedWin.py +++ b/Demo/tix/samples/PanedWin.py @@ -17,7 +17,7 @@ import Tix -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): panedwin = DemoPanedwin(root) diff --git a/Demo/tix/samples/PopMenu.py b/Demo/tix/samples/PopMenu.py index 602eafd..32f3229 100755 --- a/Demo/tix/samples/PopMenu.py +++ b/Demo/tix/samples/PopMenu.py @@ -1,6 +1,6 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # -# $Id$ +# $Id$ # # Tix Demostration Program # @@ -27,9 +27,9 @@ def RunSample(w): p.bind_widget(top) p.bind_widget(but) - # Set the entries inside the PopupMenu widget. + # Set the entries inside the PopupMenu widget. # [Hint] You have to manipulate the "menu" subwidget. - # $w.top.p itself is NOT a menu widget. + # $w.top.p itself is NOT a menu widget. # [Hint] Watch carefully how the sub-menu is created # p.menu.add_command(label='Desktop', underline=0) @@ -45,9 +45,9 @@ def RunSample(w): box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL) box.add('ok', text='Ok', underline=0, width=6, - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) box.add('cancel', text='Cancel', underline=0, width=6, - command=lambda w=w: w.destroy()) + command=lambda w=w: w.destroy()) box.pack(side=Tix.BOTTOM, fill=Tix.X) top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) diff --git a/Demo/tix/samples/SHList1.py b/Demo/tix/samples/SHList1.py index 0114dc8..7ca7b3e 100755 --- a/Demo/tix/samples/SHList1.py +++ b/Demo/tix/samples/SHList1.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -15,13 +15,13 @@ import Tix -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): shlist = DemoSHList(root) shlist.mainloop() shlist.destroy() - + class DemoSHList: def __init__(self, w): self.root = w @@ -29,7 +29,7 @@ class DemoSHList: z = w.winfo_toplevel() z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - + # We create the frame and the ScrolledHList widget # at the top of the dialog box # @@ -61,7 +61,7 @@ class DemoSHList: hlist=top.a.hlist - # Let configure the appearance of the HList subwidget + # Let configure the appearance of the HList subwidget # hlist.config( separator='.', width=25, drawbranch=0, indent=10) @@ -71,7 +71,7 @@ class DemoSHList: f=Tix.Frame(hlist, name='sep%d' % count, height=2, width=150, bd=2, relief=Tix.SUNKEN ) - hlist.add_child( itemtype=Tix.WINDOW, + hlist.add_child( itemtype=Tix.WINDOW, window=f, state=Tix.DISABLED ) hlist.add(boss, itemtype=Tix.TEXT, text=name) @@ -88,13 +88,13 @@ class DemoSHList: hlist.add( key, text=name ) # [Hint] Make sure the keys (e.g. 'boss.person') you choose - # are unique names. If you cannot be sure of this (because of - # the structure of your database, e.g.) you can use the - # "add_child" command instead: + # are unique names. If you cannot be sure of this (because of + # the structure of your database, e.g.) you can use the + # "add_child" command instead: # # hlist.addchild( boss, text=name) # ^^^^ - # parent entryPath + # parent entryPath # Use a ButtonBox to hold the buttons. @@ -129,4 +129,3 @@ class DemoSHList: if __name__== '__main__' : root=Tix.Tk() RunSample(root) - diff --git a/Demo/tix/samples/SHList2.py b/Demo/tix/samples/SHList2.py index e82d1e5..17fd551 100755 --- a/Demo/tix/samples/SHList2.py +++ b/Demo/tix/samples/SHList2.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -13,18 +13,18 @@ # This file demonstrates how to use multiple columns and multiple styles # in the tixHList widget # -# In a tixHList widget, you can have one ore more columns. +# In a tixHList widget, you can have one ore more columns. # import Tix -TCL_ALL_EVENTS = 0 +TCL_ALL_EVENTS = 0 def RunSample (root): shlist = DemoSHList(root) shlist.mainloop() shlist.destroy() - + class DemoSHList: def __init__(self, w): self.root = w @@ -32,7 +32,7 @@ class DemoSHList: z = w.winfo_toplevel() z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - + # We create the frame and the ScrolledHList widget # at the top of the dialog box # @@ -47,7 +47,7 @@ class DemoSHList: hlist=top.a.hlist # Create the title for the HList widget - # >> Notice that we have set the hlist.header subwidget option to true + # >> Notice that we have set the hlist.header subwidget option to true # so that the header is displayed # @@ -72,22 +72,22 @@ class DemoSHList: # This is our little relational database # - boss = ('doe', 'John Doe', 'Director') + boss = ('doe', 'John Doe', 'Director') managers = [ - ('jeff', 'Jeff Waxman', 'Manager'), - ('john', 'John Lee', 'Manager'), - ('peter', 'Peter Kenson', 'Manager') + ('jeff', 'Jeff Waxman', 'Manager'), + ('john', 'John Lee', 'Manager'), + ('peter', 'Peter Kenson', 'Manager') ] employees = [ - ('alex', 'john', 'Alex Kellman', 'Clerk'), - ('alan', 'john', 'Alan Adams', 'Clerk'), - ('andy', 'peter', 'Andreas Crawford', 'Salesman'), - ('doug', 'jeff', 'Douglas Bloom', 'Clerk'), - ('jon', 'peter', 'Jon Baraki', 'Salesman'), - ('chris', 'jeff', 'Chris Geoffrey', 'Clerk'), - ('chuck', 'jeff', 'Chuck McLean', 'Cleaner') + ('alex', 'john', 'Alex Kellman', 'Clerk'), + ('alan', 'john', 'Alan Adams', 'Clerk'), + ('andy', 'peter', 'Andreas Crawford', 'Salesman'), + ('doug', 'jeff', 'Douglas Bloom', 'Clerk'), + ('jon', 'peter', 'Jon Baraki', 'Salesman'), + ('chris', 'jeff', 'Chris Geoffrey', 'Clerk'), + ('chuck', 'jeff', 'Chuck McLean', 'Cleaner') ] style['mgr_name'] = Tix.DisplayStyle(Tix.TEXT, refwindow=hlist) @@ -98,7 +98,7 @@ class DemoSHList: style['empl_posn'] = Tix.DisplayStyle(Tix.TEXT, padx=8, refwindow=hlist) - # Let configure the appearance of the HList subwidget + # Let configure the appearance of the HList subwidget # hlist.config(separator='.', width=25, drawbranch=0, indent=10) hlist.column_width(0, chars=20) @@ -124,10 +124,10 @@ class DemoSHList: for key,mgr,name,posn in employees : # "." is the separator character we chose above - entrypath = '.' + mgr + '.' + key + entrypath = '.' + mgr + '.' + key # ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ - # parent entryPath / child's name + # parent entryPath / child's name hlist.add(entrypath, text=name, style=style['empl_name']) hlist.item_create(entrypath, 1, itemtype=Tix.TEXT, @@ -166,4 +166,3 @@ class DemoSHList: if __name__== '__main__' : root=Tix.Tk() RunSample(root) - diff --git a/Demo/tix/samples/Tree.py b/Demo/tix/samples/Tree.py index 2fdd7c7..9a7e481 100755 --- a/Demo/tix/samples/Tree.py +++ b/Demo/tix/samples/Tree.py @@ -1,5 +1,5 @@ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# +# # $Id$ # # Tix Demostration Program @@ -34,17 +34,17 @@ def RunSample(w): def adddir(tree, dir): if dir == '/': - text = '/' + text = '/' else: - text = os.path.basename(dir) + text = os.path.basename(dir) tree.hlist.add(dir, itemtype=Tix.IMAGETEXT, text=text, - image=tree.tk.call('tix', 'getimage', 'folder')) + image=tree.tk.call('tix', 'getimage', 'folder')) try: - os.listdir(dir) - tree.setmode(dir, 'open') + os.listdir(dir) + tree.setmode(dir, 'open') except os.error: - # No read permission ? - pass + # No read permission ? + pass # This function is called whenever the user presses the (+) indicator or # double clicks on a directory whose mode is "open". It loads the files @@ -57,22 +57,22 @@ def adddir(tree, dir): def opendir(tree, dir): entries = tree.hlist.info_children(dir) if entries: - # We have already loaded this directory. Let's just - # show all the child entries - # - # Note: since we load the directory only once, it will not be - # refreshed if the you add or remove files from this - # directory. - # - for entry in entries: - tree.hlist.show_entry(entry) + # We have already loaded this directory. Let's just + # show all the child entries + # + # Note: since we load the directory only once, it will not be + # refreshed if the you add or remove files from this + # directory. + # + for entry in entries: + tree.hlist.show_entry(entry) files = os.listdir(dir) for file in files: - if os.path.isdir(dir + '/' + file): - adddir(tree, dir + '/' + file) - else: - tree.hlist.add(dir + '/' + file, itemtype=Tix.IMAGETEXT, text=file, - image=tree.tk.call('tix', 'getimage', 'file')) + if os.path.isdir(dir + '/' + file): + adddir(tree, dir + '/' + file) + else: + tree.hlist.add(dir + '/' + file, itemtype=Tix.IMAGETEXT, text=file, + image=tree.tk.call('tix', 'getimage', 'file')) if __name__ == '__main__': root = Tix.Tk() |