mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Whitespace normalization, via reindent.py.
This commit is contained in:
parent
e6ddc8b20b
commit
182b5aca27
453 changed files with 31318 additions and 31452 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
import Tix
|
||||
|
||||
TCL_ALL_EVENTS = 0
|
||||
TCL_ALL_EVENTS = 0
|
||||
|
||||
def RunSample (root):
|
||||
balloon = DemoBalloon(root)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import Tix
|
||||
|
||||
TCL_ALL_EVENTS = 0
|
||||
TCL_ALL_EVENTS = 0
|
||||
|
||||
def RunSample (root):
|
||||
panedwin = DemoPanedwin(root)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue