summaryrefslogtreecommitdiffstats
path: root/Demo/tix
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-18 06:16:08 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-18 06:16:08 (GMT)
commit182b5aca27d376b08a2904bed42b751496f932f3 (patch)
treedf13115820dbc879c0fe2eae488c9f8c0215a7da /Demo/tix
parente6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff)
downloadcpython-182b5aca27d376b08a2904bed42b751496f932f3.zip
cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz
cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Demo/tix')
-rwxr-xr-xDemo/tix/samples/Balloon.py2
-rwxr-xr-xDemo/tix/samples/BtnBox.py8
-rwxr-xr-xDemo/tix/samples/CmpImg.py37
-rwxr-xr-xDemo/tix/samples/ComboBox.py20
-rwxr-xr-xDemo/tix/samples/Control.py16
-rwxr-xr-xDemo/tix/samples/DirList.py17
-rwxr-xr-xDemo/tix/samples/DirTree.py11
-rwxr-xr-xDemo/tix/samples/NoteBook.py50
-rwxr-xr-xDemo/tix/samples/OptMenu.py24
-rwxr-xr-xDemo/tix/samples/PanedWin.py2
-rwxr-xr-xDemo/tix/samples/PopMenu.py10
-rwxr-xr-xDemo/tix/samples/SHList1.py21
-rwxr-xr-xDemo/tix/samples/SHList2.py41
-rwxr-xr-xDemo/tix/samples/Tree.py44
-rw-r--r--Demo/tix/tixwidgets.py391
15 files changed, 344 insertions, 350 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()
diff --git a/Demo/tix/tixwidgets.py b/Demo/tix/tixwidgets.py
index ae7b063..de2e22e 100644
--- a/Demo/tix/tixwidgets.py
+++ b/Demo/tix/tixwidgets.py
@@ -4,38 +4,38 @@
#
# tixwidgets.py --
#
-# For Tix, see http://tix.sourceforge.net
+# For Tix, see http://tix.sourceforge.net
#
-# This is a demo program of some of the Tix widgets available in Python.
-# If you have installed Python & Tix properly, you can execute this as
+# This is a demo program of some of the Tix widgets available in Python.
+# If you have installed Python & Tix properly, you can execute this as
#
-# % python tixwidgets.py
+# % python tixwidgets.py
#
import os, os.path, sys, Tix
from Tkconstants import *
import traceback, tkMessageBox
-TCL_DONT_WAIT = 1<<1
-TCL_WINDOW_EVENTS = 1<<2
-TCL_FILE_EVENTS = 1<<3
-TCL_TIMER_EVENTS = 1<<4
-TCL_IDLE_EVENTS = 1<<5
-TCL_ALL_EVENTS = 0
+TCL_DONT_WAIT = 1<<1
+TCL_WINDOW_EVENTS = 1<<2
+TCL_FILE_EVENTS = 1<<3
+TCL_TIMER_EVENTS = 1<<4
+TCL_IDLE_EVENTS = 1<<5
+TCL_ALL_EVENTS = 0
class Demo:
def __init__(self, top):
self.root = top
self.exit = -1
- self.dir = None # script directory
- self.balloon = None # balloon widget
+ self.dir = None # script directory
+ self.balloon = None # balloon widget
self.useBalloons = Tix.StringVar()
self.useBalloons.set('0')
- self.statusbar = None # status bar widget
- self.welmsg = None # Msg widget
- self.welfont = '' # font name
- self.welsize = '' # font size
+ self.statusbar = None # status bar widget
+ self.welmsg = None # Msg widget
+ self.welfont = '' # font name
+ self.welsize = '' # font size
progname = sys.argv[0]
dirname = os.path.dirname(progname)
@@ -72,7 +72,7 @@ class Demo:
variable=self.useBalloons)
# The trace variable option doesn't seem to work, instead I use 'command'
#apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w',
- # ToggleHelp))
+ # ToggleHelp))
return w
@@ -130,15 +130,15 @@ class Demo:
# To show Tcl errors - uncomment this to see the listbox bug.
# Tkinter defines a Tcl tkerror procedure that in effect
# silences all background Tcl error reporting.
- # root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}')
+ # root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}')
def quitcmd (self):
"""Quit our mainloop. It is up to you to call root.destroy() after."""
self.exit = 0
def loop(self):
- """This is an explict replacement for _tkinter mainloop()
- It lets you catch keyboard interrupts easier, and avoids
- the 20 msec. dead sleep() which burns a constant CPU."""
+ """This is an explict replacement for _tkinter mainloop()
+ It lets you catch keyboard interrupts easier, and avoids
+ the 20 msec. dead sleep() which burns a constant CPU."""
while self.exit < 0:
# There are 2 whiles here. The outer one lets you continue
# after a ^C interrupt.
@@ -221,9 +221,9 @@ def MkWelcomeBar(top):
b2.pack(side=Tix.LEFT, padx=4, pady=4)
demo.balloon.bind_widget(b1, msg='Choose\na font',
- statusmsg='Choose a font for this page')
+ statusmsg='Choose a font for this page')
demo.balloon.bind_widget(b2, msg='Point size',
- statusmsg='Choose the font size for this page')
+ statusmsg='Choose the font size for this page')
return w
def MkWelcomeText(top):
@@ -233,10 +233,10 @@ def MkWelcomeText(top):
win = w.window
text = 'Welcome to TIX in Python'
title = Tix.Label(win,
- bd=0, width=30, anchor=Tix.N, text=text)
+ bd=0, width=30, anchor=Tix.N, text=text)
msg = Tix.Message(win,
- bd=0, width=400, anchor=Tix.N,
- text='Tix is a set of mega-widgets based on TK. This program \
+ bd=0, width=400, anchor=Tix.N,
+ text='Tix is a set of mega-widgets based on TK. This program \
demonstrates the widgets in the Tix widget set. You can choose the pages \
in this window to look at the corresponding widgets. \n\n\
To quit this program, choose the "File | Exit" command.\n\n\
@@ -250,19 +250,19 @@ def MainTextFont(w):
global demo
if not demo.welmsg:
- return
+ return
font = demo.welfont['value']
point = demo.welsize['value']
if font == 'Times Roman':
- font = 'times'
+ font = 'times'
fontstr = '%s %s' % (font, point)
demo.welmsg['font'] = fontstr
def ToggleHelp():
if demo.useBalloons.get() == '1':
- demo.balloon['state'] = 'both'
+ demo.balloon['state'] = 'both'
else:
- demo.balloon['state'] = 'none'
+ demo.balloon['state'] = 'none'
def MkChoosers(nb, name):
w = nb.page(name)
@@ -307,7 +307,7 @@ def MkCombo(w):
static = Tix.ComboBox(w, label='Static', editable=0, options=options)
editable = Tix.ComboBox(w, label='Editable', editable=1, options=options)
history = Tix.ComboBox(w, label='History', editable=1, history=1,
- anchor=Tix.E, options=options)
+ anchor=Tix.E, options=options)
static.insert(Tix.END, 'January')
static.insert(Tix.END, 'February')
static.insert(Tix.END, 'March')
@@ -340,20 +340,20 @@ states = ['Bengal', 'Delhi', 'Karnataka', 'Tamil Nadu']
def spin_cmd(w, inc):
idx = states.index(demo_spintxt.get()) + inc
if idx < 0:
- idx = len(states) - 1
+ idx = len(states) - 1
elif idx >= len(states):
- idx = 0
+ idx = 0
# following doesn't work.
# return states[idx]
- demo_spintxt.set(states[idx]) # this works
+ demo_spintxt.set(states[idx]) # this works
def spin_validate(w):
global states, demo_spintxt
try:
- i = states.index(demo_spintxt.get())
+ i = states.index(demo_spintxt.get())
except ValueError:
- return states[0]
+ return states[0]
return states[i]
# why this procedure works as opposed to the previous one beats me.
@@ -417,8 +417,8 @@ def MkOptMenu(w):
def MkFileEnt(w):
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
ent = Tix.FileEntry(w, label='Select a file : ')
msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
ent.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
@@ -429,8 +429,8 @@ def MkFileBox(w):
and your past selections are recorded.
"""
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
box = Tix.FileSelectBox(w)
msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
box.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
@@ -443,8 +443,8 @@ def MkToolBar(w):
options='frame.borderWidth 1'
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='The Select widget is also good for arranging buttons in a tool bar.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='The Select widget is also good for arranging buttons in a tool bar.')
bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
font = Tix.Select(w, allowzero=1, radio=0, label='', options=options)
para = Tix.Select(w, allowzero=0, radio=1, label='', options=options)
@@ -466,8 +466,8 @@ def MkToolBar(w):
def MkTitle(w):
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='There are many types of "chooser" widgets that allow the user to input different types of information')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='There are many types of "chooser" widgets that allow the user to input different types of information')
msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
def MkScroll(nb, name):
@@ -494,8 +494,8 @@ def MkSList(w):
top = Tix.Frame(w, width=300, height=330)
bot = Tix.Frame(w)
msg = Tix.Message(top,
- relief=Tix.FLAT, width=200, anchor=Tix.N,
- text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.')
+ relief=Tix.FLAT, width=200, anchor=Tix.N,
+ text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.')
list = Tix.ScrolledListBox(top, scrollbar='auto')
list.place(x=50, y=150, width=120, height=80)
@@ -508,8 +508,8 @@ def MkSList(w):
list.listbox.insert(Tix.END, 'Washington')
rh = Tix.ResizeHandle(top, bg='black',
- relief=Tix.RAISED,
- handlesize=8, gridded=1, minwidth=50, minheight=30)
+ relief=Tix.RAISED,
+ handlesize=8, gridded=1, minwidth=50, minheight=30)
btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x))
top.propagate(0)
msg.pack(fill=Tix.X)
@@ -517,7 +517,7 @@ def MkSList(w):
top.pack(expand=1, fill=Tix.BOTH)
bot.pack(fill=Tix.BOTH)
list.bind('<Map>', func=lambda arg=0, rh=rh, list=list:
- list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
+ list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
def SList_reset(rh, list):
list.place(x=50, y=150, width=120, height=80)
@@ -539,8 +539,8 @@ def MkSWindow(w):
top = Tix.Frame(w, width=330, height=330)
bot = Tix.Frame(w)
msg = Tix.Message(top,
- relief=Tix.FLAT, width=200, anchor=Tix.N,
- text=text)
+ relief=Tix.FLAT, width=200, anchor=Tix.N,
+ text=text)
win = Tix.ScrolledWindow(top, scrollbar='auto')
@@ -551,8 +551,8 @@ def MkSWindow(w):
win.place(x=30, y=150, width=190, height=120)
rh = Tix.ResizeHandle(top, bg='black',
- relief=Tix.RAISED,
- handlesize=8, gridded=1, minwidth=50, minheight=30)
+ relief=Tix.RAISED,
+ handlesize=8, gridded=1, minwidth=50, minheight=30)
btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x))
top.propagate(0)
msg.pack(fill=Tix.X)
@@ -561,7 +561,7 @@ def MkSWindow(w):
bot.pack(fill=Tix.BOTH)
win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
- win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
+ win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
def SWindow_reset(rh, win):
win.place(x=30, y=150, width=190, height=120)
@@ -574,27 +574,27 @@ def MkSText(w):
top = Tix.Frame(w, width=330, height=330)
bot = Tix.Frame(w)
msg = Tix.Message(top,
- relief=Tix.FLAT, width=200, anchor=Tix.N,
- text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
+ relief=Tix.FLAT, width=200, anchor=Tix.N,
+ text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
win = Tix.ScrolledText(top, scrollbar='auto')
win.text['wrap'] = 'none'
win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the
-scrollbars are shown only when needed.
+scrollbars are shown only when needed.
Additional modifiers can be used to force a
-scrollbar to be shown or hidden. For example,
-"auto -y" means the horizontal scrollbar
-should be shown when needed but the vertical
+scrollbar to be shown or hidden. For example,
+"auto -y" means the horizontal scrollbar
+should be shown when needed but the vertical
scrollbar should always be hidden;
"auto +x" means the vertical scrollbar
-should be shown when needed but the horizontal
+should be shown when needed but the horizontal
scrollbar should always be shown, and so on.'''
)
win.place(x=30, y=150, width=190, height=100)
rh = Tix.ResizeHandle(top, bg='black',
- relief=Tix.RAISED,
- handlesize=8, gridded=1, minwidth=50, minheight=30)
+ relief=Tix.RAISED,
+ handlesize=8, gridded=1, minwidth=50, minheight=30)
btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x))
top.propagate(0)
msg.pack(fill=Tix.X)
@@ -602,7 +602,7 @@ scrollbar should always be shown, and so on.'''
top.pack(expand=1, fill=Tix.BOTH)
bot.pack(fill=Tix.BOTH)
win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
- win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
+ win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
def SText_reset(rh, win):
win.place(x=30, y=150, width=190, height=120)
@@ -628,8 +628,8 @@ def MkPanedWindow(w):
or horizontally.
"""
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.')
group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
group.entry.insert(0,'comp.lang.python')
pane = Tix.PanedWindow(w, orientation='vertical')
@@ -671,8 +671,8 @@ together with a bitmap, at the same time, inside a TK button widget.
def MkNoteBook(w):
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='The NoteBook widget allows you to layout a complex interface into individual pages.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='The NoteBook widget allows you to layout a complex interface into individual pages.')
# prefix = Tix.OptionName(w)
# if not prefix: prefix = ''
# w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8)
@@ -738,8 +738,8 @@ def MkDirListWidget(w):
directories.
"""
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16')
msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
dirlist.pack(side=Tix.TOP, padx=3, pady=3)
@@ -748,8 +748,8 @@ def MkExFileWidget(w):
"""The TixExFileSelectBox widget is more user friendly than the Motif
style FileSelectBox. """
msg = Tix.Message(w,
- relief=Tix.FLAT, width=240, anchor=Tix.N,
- text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
+ relief=Tix.FLAT, width=240, anchor=Tix.N,
+ text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
# There's a bug in the ComboBoxes - the scrolledlistbox is destroyed
box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED)
msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
@@ -758,118 +758,118 @@ def MkExFileWidget(w):
###
### List of all the demos we want to show off
comments = {'widget' : 'Widget Demos', 'image' : 'Image Demos'}
-samples = {'Balloon' : 'Balloon',
- 'Button Box' : 'BtnBox',
- 'Combo Box' : 'ComboBox',
- 'Compound Image' : 'CmpImg',
- 'Directory List' : 'DirList',
- 'Directory Tree' : 'DirTree',
- 'Control' : 'Control',
- 'Notebook' : 'NoteBook',
- 'Option Menu' : 'OptMenu',
- 'Paned Window' : 'PanedWin',
- 'Popup Menu' : 'PopMenu',
- 'ScrolledHList (1)' : 'SHList1',
- 'ScrolledHList (2)' : 'SHList2',
- 'Tree (dynamic)' : 'Tree'
+samples = {'Balloon' : 'Balloon',
+ 'Button Box' : 'BtnBox',
+ 'Combo Box' : 'ComboBox',
+ 'Compound Image' : 'CmpImg',
+ 'Directory List' : 'DirList',
+ 'Directory Tree' : 'DirTree',
+ 'Control' : 'Control',
+ 'Notebook' : 'NoteBook',
+ 'Option Menu' : 'OptMenu',
+ 'Paned Window' : 'PanedWin',
+ 'Popup Menu' : 'PopMenu',
+ 'ScrolledHList (1)' : 'SHList1',
+ 'ScrolledHList (2)' : 'SHList2',
+ 'Tree (dynamic)' : 'Tree'
}
# There are still a lot of demos to be translated:
-## set root {
-## {d "File Selectors" file }
-## {d "Hierachical ListBox" hlist }
-## {d "Tabular ListBox" tlist {c tixTList}}
-## {d "Grid Widget" grid {c tixGrid}}
-## {d "Manager Widgets" manager }
-## {d "Scrolled Widgets" scroll }
-## {d "Miscellaneous Widgets" misc }
-## {d "Image Types" image }
-## }
+## set root {
+## {d "File Selectors" file }
+## {d "Hierachical ListBox" hlist }
+## {d "Tabular ListBox" tlist {c tixTList}}
+## {d "Grid Widget" grid {c tixGrid}}
+## {d "Manager Widgets" manager }
+## {d "Scrolled Widgets" scroll }
+## {d "Miscellaneous Widgets" misc }
+## {d "Image Types" image }
+## }
##
-## set image {
-## {d "Compound Image" cmpimg }
-## {d "XPM Image" xpm {i pixmap}}
-## }
+## set image {
+## {d "Compound Image" cmpimg }
+## {d "XPM Image" xpm {i pixmap}}
+## }
##
-## set cmpimg {
-##done {f "In Buttons" CmpImg.tcl }
-## {f "In NoteBook" CmpImg2.tcl }
-## {f "Notebook Color Tabs" CmpImg4.tcl }
-## {f "Icons" CmpImg3.tcl }
-## }
+## set cmpimg {
+##done {f "In Buttons" CmpImg.tcl }
+## {f "In NoteBook" CmpImg2.tcl }
+## {f "Notebook Color Tabs" CmpImg4.tcl }
+## {f "Icons" CmpImg3.tcl }
+## }
##
-## set xpm {
-## {f "In Button" Xpm.tcl {i pixmap}}
-## {f "In Menu" Xpm1.tcl {i pixmap}}
-## }
+## set xpm {
+## {f "In Button" Xpm.tcl {i pixmap}}
+## {f "In Menu" Xpm1.tcl {i pixmap}}
+## }
##
-## set file {
-##added {f DirList DirList.tcl }
-##added {f DirTree DirTree.tcl }
-## {f DirSelectDialog DirDlg.tcl }
-## {f ExFileSelectDialog EFileDlg.tcl }
-## {f FileSelectDialog FileDlg.tcl }
-## {f FileEntry FileEnt.tcl }
-## }
+## set file {
+##added {f DirList DirList.tcl }
+##added {f DirTree DirTree.tcl }
+## {f DirSelectDialog DirDlg.tcl }
+## {f ExFileSelectDialog EFileDlg.tcl }
+## {f FileSelectDialog FileDlg.tcl }
+## {f FileEntry FileEnt.tcl }
+## }
##
-## set hlist {
-## {f HList HList1.tcl }
-## {f CheckList ChkList.tcl {c tixCheckList}}
-##done {f "ScrolledHList (1)" SHList.tcl }
-##done {f "ScrolledHList (2)" SHList2.tcl }
-##done {f Tree Tree.tcl }
-##done {f "Tree (Dynamic)" DynTree.tcl {v win}}
-## }
+## set hlist {
+## {f HList HList1.tcl }
+## {f CheckList ChkList.tcl {c tixCheckList}}
+##done {f "ScrolledHList (1)" SHList.tcl }
+##done {f "ScrolledHList (2)" SHList2.tcl }
+##done {f Tree Tree.tcl }
+##done {f "Tree (Dynamic)" DynTree.tcl {v win}}
+## }
##
-## set tlist {
-## {f "ScrolledTList (1)" STList1.tcl {c tixTList}}
-## {f "ScrolledTList (2)" STList2.tcl {c tixTList}}
-## }
-## global tcl_platform
-## # This demo hangs windows
-## if {$tcl_platform(platform) != "windows"} {
-##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}}
-## }
+## set tlist {
+## {f "ScrolledTList (1)" STList1.tcl {c tixTList}}
+## {f "ScrolledTList (2)" STList2.tcl {c tixTList}}
+## }
+## global tcl_platform
+## # This demo hangs windows
+## if {$tcl_platform(platform) != "windows"} {
+##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}}
+## }
##
-## set grid {
-##na {f "Simple Grid" SGrid0.tcl {c tixGrid}}
-##na {f "ScrolledGrid" SGrid1.tcl {c tixGrid}}
-##na {f "Editable Grid" EditGrid.tcl {c tixGrid}}
-## }
+## set grid {
+##na {f "Simple Grid" SGrid0.tcl {c tixGrid}}
+##na {f "ScrolledGrid" SGrid1.tcl {c tixGrid}}
+##na {f "Editable Grid" EditGrid.tcl {c tixGrid}}
+## }
##
-## set scroll {
-## {f ScrolledListBox SListBox.tcl }
-## {f ScrolledText SText.tcl }
-## {f ScrolledWindow SWindow.tcl }
-##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}}
-## }
+## set scroll {
+## {f ScrolledListBox SListBox.tcl }
+## {f ScrolledText SText.tcl }
+## {f ScrolledWindow SWindow.tcl }
+##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}}
+## }
##
-## set manager {
-## {f ListNoteBook ListNBK.tcl }
-##done {f NoteBook NoteBook.tcl }
-##done {f PanedWindow PanedWin.tcl }
-## }
+## set manager {
+## {f ListNoteBook ListNBK.tcl }
+##done {f NoteBook NoteBook.tcl }
+##done {f PanedWindow PanedWin.tcl }
+## }
##
-## set misc {
-##done {f Balloon Balloon.tcl }
-##done {f ButtonBox BtnBox.tcl }
-##done {f ComboBox ComboBox.tcl }
-##done {f Control Control.tcl }
-## {f LabelEntry LabEntry.tcl }
-## {f LabelFrame LabFrame.tcl }
-## {f Meter Meter.tcl {c tixMeter}}
-##done {f OptionMenu OptMenu.tcl }
-##done {f PopupMenu PopMenu.tcl }
-## {f Select Select.tcl }
-## {f StdButtonBox StdBBox.tcl }
-## }
+## set misc {
+##done {f Balloon Balloon.tcl }
+##done {f ButtonBox BtnBox.tcl }
+##done {f ComboBox ComboBox.tcl }
+##done {f Control Control.tcl }
+## {f LabelEntry LabEntry.tcl }
+## {f LabelFrame LabFrame.tcl }
+## {f Meter Meter.tcl {c tixMeter}}
+##done {f OptionMenu OptMenu.tcl }
+##done {f PopupMenu PopMenu.tcl }
+## {f Select Select.tcl }
+## {f StdButtonBox StdBBox.tcl }
+## }
##
stypes = {}
stypes['widget'] = ['Balloon', 'Button Box', 'Combo Box', 'Control',
'Directory List', 'Directory Tree',
- 'Notebook', 'Option Menu', 'Popup Menu', 'Paned Window',
- 'ScrolledHList (1)', 'ScrolledHList (2)', 'Tree (dynamic)']
+ 'Notebook', 'Option Menu', 'Popup Menu', 'Paned Window',
+ 'ScrolledHList (1)', 'ScrolledHList (2)', 'Tree (dynamic)']
stypes['image'] = ['Compound Image']
def MkSample(nb, name):
@@ -922,15 +922,15 @@ def MkSample(nb, name):
view['command'] = lambda args=0, w=w,slb=slb,stext=stext,run=run,view=view: Sample_Action(w, slb, stext, run, view, 'view')
for type in ['widget', 'image']:
- if type != 'widget':
- x = Tix.Frame(slb.hlist, bd=2, height=2, width=150,
- relief=Tix.SUNKEN, bg=slb.hlist['bg'])
- slb.hlist.add_child(itemtype=Tix.WINDOW, window=x, state='disabled')
- x = slb.hlist.add_child(itemtype=Tix.TEXT, state='disabled',
- text=comments[type])
- for key in stypes[type]:
- slb.hlist.add_child(x, itemtype=Tix.TEXT, data=key,
- text=key)
+ if type != 'widget':
+ x = Tix.Frame(slb.hlist, bd=2, height=2, width=150,
+ relief=Tix.SUNKEN, bg=slb.hlist['bg'])
+ slb.hlist.add_child(itemtype=Tix.WINDOW, window=x, state='disabled')
+ x = slb.hlist.add_child(itemtype=Tix.TEXT, state='disabled',
+ text=comments[type])
+ for key in stypes[type]:
+ slb.hlist.add_child(x, itemtype=Tix.TEXT, data=key,
+ text=key)
slb.hlist.selection_clear()
run['state'] = 'disabled'
@@ -942,11 +942,11 @@ def Sample_Action(w, slb, stext, run, view, action):
hlist = slb.hlist
anchor = hlist.info_anchor()
if not anchor:
- run['state'] = 'disabled'
- view['state'] = 'disabled'
+ run['state'] = 'disabled'
+ view['state'] = 'disabled'
elif not hlist.info_parent(anchor):
- # a comment
- return
+ # a comment
+ return
run['state'] = 'normal'
view['state'] = 'normal'
@@ -955,17 +955,17 @@ def Sample_Action(w, slb, stext, run, view, action):
prog = samples[key]
if action == 'run':
- exec('import ' + prog)
- w = Tix.Toplevel()
- w.title(title)
- rtn = eval(prog + '.RunSample')
- rtn(w)
+ exec('import ' + prog)
+ w = Tix.Toplevel()
+ w.title(title)
+ rtn = eval(prog + '.RunSample')
+ rtn(w)
elif action == 'view':
- w = Tix.Toplevel()
- w.title('Source view: ' + title)
- LoadFile(w, demo.dir + '/samples/' + prog + '.py')
+ w = Tix.Toplevel()
+ w.title('Source view: ' + title)
+ LoadFile(w, demo.dir + '/samples/' + prog + '.py')
elif action == 'browse':
- ReadFile(stext.text, demo.dir + '/samples/' + prog + '.py')
+ ReadFile(stext.text, demo.dir + '/samples/' + prog + '.py')
def LoadFile(w, fname):
global root
@@ -989,16 +989,15 @@ def ReadFile(w, fname):
w.delete('0.0', Tix.END)
try:
- f = open(fname)
- lines = f.readlines()
- for s in lines:
- w.insert(Tix.END, s)
- f.close()
+ f = open(fname)
+ lines = f.readlines()
+ for s in lines:
+ w.insert(Tix.END, s)
+ f.close()
finally:
-# w.see('1.0')
- w['state'] = old_state
+# w.see('1.0')
+ w['state'] = old_state
if __name__ == '__main__':
root = Tix.Tk()
RunMain(root)
-