summaryrefslogtreecommitdiffstats
path: root/Demo/tix/samples
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/tix/samples')
-rwxr-xr-xDemo/tix/samples/Balloon.py18
-rwxr-xr-xDemo/tix/samples/BtnBox.py14
-rwxr-xr-xDemo/tix/samples/CmpImg.py28
-rwxr-xr-xDemo/tix/samples/ComboBox.py58
-rwxr-xr-xDemo/tix/samples/Control.py30
-rwxr-xr-xDemo/tix/samples/DirList.py20
-rwxr-xr-xDemo/tix/samples/DirTree.py16
-rwxr-xr-xDemo/tix/samples/NoteBook.py72
-rwxr-xr-xDemo/tix/samples/OptMenu.py24
-rwxr-xr-xDemo/tix/samples/PanedWin.py40
-rwxr-xr-xDemo/tix/samples/PopMenu.py22
-rwxr-xr-xDemo/tix/samples/SHList1.py26
-rwxr-xr-xDemo/tix/samples/SHList2.py42
-rwxr-xr-xDemo/tix/samples/Tree.py20
14 files changed, 215 insertions, 215 deletions
diff --git a/Demo/tix/samples/Balloon.py b/Demo/tix/samples/Balloon.py
index 2295905..bc25a2e 100755
--- a/Demo/tix/samples/Balloon.py
+++ b/Demo/tix/samples/Balloon.py
@@ -15,7 +15,7 @@
# Your can display the help message in a "balloon" and a status bar widget.
#
-import Tix
+import tkinter.tix
TCL_ALL_EVENTS = 0
@@ -32,20 +32,20 @@ class DemoBalloon:
z = w.winfo_toplevel()
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
- status = Tix.Label(w, width=40, relief=Tix.SUNKEN, bd=1)
- status.pack(side=Tix.BOTTOM, fill=Tix.Y, padx=2, pady=1)
+ status = tkinter.tix.Label(w, width=40, relief=tkinter.tix.SUNKEN, bd=1)
+ status.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.Y, padx=2, pady=1)
# Create two mysterious widgets that need balloon help
- button1 = Tix.Button(w, text='Something Unexpected',
+ button1 = tkinter.tix.Button(w, text='Something Unexpected',
command=self.quitcmd)
- button2 = Tix.Button(w, text='Something Else Unexpected')
+ button2 = tkinter.tix.Button(w, text='Something Else Unexpected')
button2['command'] = lambda w=button2: w.destroy()
- button1.pack(side=Tix.TOP, expand=1)
- button2.pack(side=Tix.TOP, expand=1)
+ button1.pack(side=tkinter.tix.TOP, expand=1)
+ button2.pack(side=tkinter.tix.TOP, expand=1)
# Create the balloon widget and associate it with the widgets that we want
# to provide tips for:
- b = Tix.Balloon(w, statusbar=status)
+ b = tkinter.tix.Balloon(w, statusbar=status)
b.bind_widget(button1, balloonmsg='Close Window',
statusmsg='Press this button to close this window')
@@ -64,5 +64,5 @@ class DemoBalloon:
self.root.destroy()
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
diff --git a/Demo/tix/samples/BtnBox.py b/Demo/tix/samples/BtnBox.py
index af2a2a8..3b9ee4b 100755
--- a/Demo/tix/samples/BtnBox.py
+++ b/Demo/tix/samples/BtnBox.py
@@ -15,13 +15,13 @@
# for example.
#
-import Tix
+import tkinter.tix
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')
+ top = tkinter.tix.Label(w, padx=20, pady=10, bd=1, relief=tkinter.tix.RAISED,
+ anchor=tkinter.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
@@ -30,15 +30,15 @@ def RunSample(w):
# Note that the -text, -underline, -command and -width options are all
# standard options of the button widgets.
#
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='OK', underline=0, width=5,
command=lambda w=w: w.destroy())
box.add('close', text='Cancel', underline=0, width=5,
command=lambda w=w: w.destroy())
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
- top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()
diff --git a/Demo/tix/samples/CmpImg.py b/Demo/tix/samples/CmpImg.py
index 4720a10..ad49181 100755
--- a/Demo/tix/samples/CmpImg.py
+++ b/Demo/tix/samples/CmpImg.py
@@ -15,7 +15,7 @@
# buttons
#
-import Tix
+import tkinter.tix
network_pixmap = """/* XPM */
static char * netw_xpm[] = {
@@ -144,15 +144,15 @@ static unsigned char drivea_bits[] = {
"""
def RunSample(w):
- w.img0 = Tix.Image('pixmap', data=network_pixmap)
+ w.img0 = tkinter.tix.Image('pixmap', data=network_pixmap)
if not w.img0:
- w.img0 = Tix.Image('bitmap', data=network_bitmap)
- w.img1 = Tix.Image('pixmap', data=hard_disk_pixmap)
+ w.img0 = tkinter.tix.Image('bitmap', data=network_bitmap)
+ w.img1 = tkinter.tix.Image('pixmap', data=hard_disk_pixmap)
if not w.img0:
- w.img1 = Tix.Image('bitmap', data=hard_disk_bitmap)
+ w.img1 = tkinter.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)
+ hdd = tkinter.tix.Button(w, padx=4, pady=1, width=120)
+ net = tkinter.tix.Button(w, padx=4, pady=1, width=120)
# Create the first image: we create a line, then put a string,
# a space and a image into this line, from left to right.
@@ -160,7 +160,7 @@ def RunSample(w):
# individual items
#
# The tk.calls should be methods in Tix ...
- w.hdd_img = Tix.Image('compound', window=hdd)
+ w.hdd_img = tkinter.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')
@@ -172,7 +172,7 @@ def RunSample(w):
hdd['image'] = w.hdd_img
# Next button
- w.net_img = Tix.Image('compound', window=net)
+ w.net_img = tkinter.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')
@@ -183,14 +183,14 @@ def RunSample(w):
#
net['image'] = w.net_img
- close = Tix.Button(w, pady=1, text='Close',
+ close = tkinter.tix.Button(w, pady=1, text='Close',
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)
- close.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1)
+ hdd.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
+ net.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
+ close.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()
diff --git a/Demo/tix/samples/ComboBox.py b/Demo/tix/samples/ComboBox.py
index 9140987..80d78f2 100755
--- a/Demo/tix/samples/ComboBox.py
+++ b/Demo/tix/samples/ComboBox.py
@@ -13,15 +13,15 @@
# This file demonstrates the use of the tixComboBox widget, which is close
# to the MS Window Combo Box control.
#
-import Tix
+import tkinter.tix
def RunSample(w):
global demo_month, demo_year
- top = Tix.Frame(w, bd=1, relief=Tix.RAISED)
+ top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED)
- demo_month = Tix.StringVar()
- demo_year = Tix.StringVar()
+ demo_month = tkinter.tix.StringVar()
+ demo_year = tkinter.tix.StringVar()
# $w.top.a is a drop-down combo box. It is not editable -- who wants
# to invent new months?
@@ -30,7 +30,7 @@ def RunSample(w):
# [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,
+ a = tkinter.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')
@@ -43,31 +43,31 @@ def RunSample(w):
# [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,
+ b = tkinter.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')
- a.pack(side=Tix.TOP, anchor=Tix.W)
- b.pack(side=Tix.TOP, anchor=Tix.W)
+ a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
+ b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
- a.insert(Tix.END, 'January')
- a.insert(Tix.END, 'February')
- a.insert(Tix.END, 'March')
- a.insert(Tix.END, 'April')
- a.insert(Tix.END, 'May')
- a.insert(Tix.END, 'June')
- a.insert(Tix.END, 'July')
- a.insert(Tix.END, 'August')
- a.insert(Tix.END, 'September')
- a.insert(Tix.END, 'October')
- a.insert(Tix.END, 'November')
- a.insert(Tix.END, 'December')
+ a.insert(tkinter.tix.END, 'January')
+ a.insert(tkinter.tix.END, 'February')
+ a.insert(tkinter.tix.END, 'March')
+ a.insert(tkinter.tix.END, 'April')
+ a.insert(tkinter.tix.END, 'May')
+ a.insert(tkinter.tix.END, 'June')
+ a.insert(tkinter.tix.END, 'July')
+ a.insert(tkinter.tix.END, 'August')
+ a.insert(tkinter.tix.END, 'September')
+ a.insert(tkinter.tix.END, 'October')
+ a.insert(tkinter.tix.END, 'November')
+ a.insert(tkinter.tix.END, 'December')
- b.insert(Tix.END, '1992')
- b.insert(Tix.END, '1993')
- b.insert(Tix.END, '1994')
- b.insert(Tix.END, '1995')
- b.insert(Tix.END, '1996')
+ b.insert(tkinter.tix.END, '1992')
+ b.insert(tkinter.tix.END, '1993')
+ b.insert(tkinter.tix.END, '1994')
+ b.insert(tkinter.tix.END, '1995')
+ b.insert(tkinter.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
@@ -76,13 +76,13 @@ def RunSample(w):
a.set_silent('January')
b.set_silent('1995')
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='Ok', underline=0, width=6,
command=lambda w=w: ok_command(w))
box.add('cancel', text='Cancel', underline=0, width=6,
command=lambda w=w: w.destroy())
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
- top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
def select_month(event=None):
# tixDemo:Status "Month = %s" % demo_month.get()
@@ -97,6 +97,6 @@ def ok_command(w):
w.destroy()
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()
diff --git a/Demo/tix/samples/Control.py b/Demo/tix/samples/Control.py
index 3a344c1..fbc5e64 100755
--- a/Demo/tix/samples/Control.py
+++ b/Demo/tix/samples/Control.py
@@ -18,7 +18,7 @@
# integer values; one lets you select floating point values and the last
# one lets you select a few names.
-import Tix
+import tkinter.tix
TCL_ALL_EVENTS = 0
@@ -34,14 +34,14 @@ class DemoControl:
global demo_maker, demo_thrust, demo_num_engines
- demo_maker = Tix.StringVar()
- demo_thrust = Tix.DoubleVar()
- demo_num_engines = Tix.IntVar()
+ demo_maker = tkinter.tix.StringVar()
+ demo_thrust = tkinter.tix.DoubleVar()
+ demo_num_engines = tkinter.tix.IntVar()
demo_maker.set('P&W')
demo_thrust.set(20000.0)
demo_num_engines.set(2)
- top = Tix.Frame(w, bd=1, relief=Tix.RAISED)
+ top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED)
# $w.top.a allows only integer values
#
@@ -49,16 +49,16 @@ class DemoControl:
# [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,
+ a = tkinter.tix.Control(top, label='Number of Engines: ', integer=1,
variable=demo_num_engines, min=1, max=4,
options='entry.width 10 label.width 20 label.anchor e')
- b = Tix.Control(top, label='Thrust: ', integer=0,
+ b = tkinter.tix.Control(top, label='Thrust: ', integer=0,
min='10000.0', max='60000.0', step=500,
variable=demo_thrust,
options='entry.width 10 label.width 20 label.anchor e')
- c = Tix.Control(top, label='Engine Maker: ', value='P&W',
+ c = tkinter.tix.Control(top, label='Engine Maker: ', value='P&W',
variable=demo_maker,
options='entry.width 10 label.width 20 label.anchor e')
@@ -68,17 +68,17 @@ class DemoControl:
c['decrcmd'] = lambda w=c: adjust_maker(w, -1)
c['validatecmd'] = lambda w=c: validate_maker(w)
- a.pack(side=Tix.TOP, anchor=Tix.W)
- b.pack(side=Tix.TOP, anchor=Tix.W)
- c.pack(side=Tix.TOP, anchor=Tix.W)
+ a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
+ b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
+ c.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='Ok', underline=0, width=6,
command=self.okcmd)
box.add('cancel', text='Cancel', underline=0, width=6,
command=self.quitcmd)
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
- top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
def okcmd (self):
# tixDemo:Status "Selected %d of %s engines each of thrust %d", (demo_num_engines.get(), demo_maker.get(), demo_thrust.get())
@@ -118,5 +118,5 @@ def validate_maker(w):
return maker_list[i]
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
diff --git a/Demo/tix/samples/DirList.py b/Demo/tix/samples/DirList.py
index 5fd8c0d..6d28ca3 100755
--- a/Demo/tix/samples/DirList.py
+++ b/Demo/tix/samples/DirList.py
@@ -16,8 +16,8 @@
# installation directory for an application.
#
-import Tix, os, copy
-from Tkconstants import *
+import tkinter.tix, os, copy
+from tkinter.constants import *
TCL_ALL_EVENTS = 0
@@ -40,25 +40,25 @@ class DemoDirList:
# bg = root.tk.eval('tix option get bg')
# adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0
- top = Tix.Frame( w, relief=RAISED, bd=1)
+ top = tkinter.tix.Frame( w, relief=RAISED, bd=1)
# Create the DirList widget. By default it will show the current
# directory
#
#
- top.dir = Tix.DirList(top)
+ top.dir = tkinter.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)
+ top.btn = tkinter.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
# manually
#
- top.ent = Tix.LabelEntry(top, label="Installation Directory:",
+ top.ent = tkinter.tix.LabelEntry(top, label="Installation Directory:",
labelside = 'top',
options = '''
entry.width 40
@@ -85,7 +85,7 @@ class DemoDirList:
# Use a ButtonBox to hold the buttons.
#
- box = Tix.ButtonBox (w, orientation='horizontal')
+ box = tkinter.tix.ButtonBox (w, orientation='horizontal')
box.add ('ok', text='Ok', underline=0, width=6,
command = lambda self=self: self.okcmd () )
box.add ('cancel', text='Cancel', underline=0, width=6,
@@ -118,14 +118,14 @@ class DemoDirList:
# outside of the main demo program "tixwidgets.py".
#
if __name__== '__main__' :
- import tkMessageBox, traceback
+ import tkinter.messagebox, traceback
try:
- root=Tix.Tk()
+ root=tkinter.tix.Tk()
RunSample(root)
except:
t, v, tb = sys.exc_info()
text = "Error running the demo script:\n"
for line in traceback.format_exception(t,v,tb):
text = text + line + '\n'
- d = tkMessageBox.showerror ( 'Tix Demo Error', text)
+ d = tkinter.messagebox.showerror ( 'Tix Demo Error', text)
diff --git a/Demo/tix/samples/DirTree.py b/Demo/tix/samples/DirTree.py
index 2e4fe0b..5411ded 100755
--- a/Demo/tix/samples/DirTree.py
+++ b/Demo/tix/samples/DirTree.py
@@ -16,8 +16,8 @@
# installation directory for an application.
#
-import Tix, os, copy
-from Tkconstants import *
+import tkinter.tix, os, copy
+from tkinter.constants import *
TCL_ALL_EVENTS = 0
@@ -40,25 +40,25 @@ class DemoDirTree:
# bg = root.tk.eval('tix option get bg')
# adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0
- top = Tix.Frame( w, relief=RAISED, bd=1)
+ top = tkinter.tix.Frame( w, relief=RAISED, bd=1)
# Create the DirTree widget. By default it will show the current
# directory
#
#
- top.dir = Tix.DirTree(top)
+ top.dir = tkinter.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)
+ top.btn = tkinter.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
# manually
#
- top.ent = Tix.LabelEntry(top, label="Installation Directory:",
+ top.ent = tkinter.tix.LabelEntry(top, label="Installation Directory:",
labelside = 'top',
options = '''
entry.width 40
@@ -79,7 +79,7 @@ class DemoDirTree:
# Use a ButtonBox to hold the buttons.
#
- box = Tix.ButtonBox (w, orientation='horizontal')
+ box = tkinter.tix.ButtonBox (w, orientation='horizontal')
box.add ('ok', text='Ok', underline=0, width=6,
command = lambda self=self: self.okcmd () )
box.add ('cancel', text='Cancel', underline=0, width=6,
@@ -113,5 +113,5 @@ class DemoDirTree:
# outside of the main demo program "tixwidgets.py".
#
if __name__== '__main__' :
- root=Tix.Tk()
+ root=tkinter.tix.Tk()
RunSample(root)
diff --git a/Demo/tix/samples/NoteBook.py b/Demo/tix/samples/NoteBook.py
index 1e0da3e..d8b5fa8 100755
--- a/Demo/tix/samples/NoteBook.py
+++ b/Demo/tix/samples/NoteBook.py
@@ -13,7 +13,7 @@
# This file demonstrates the use of the tixNoteBook widget, which allows
# you to lay out your interface using a "notebook" metaphore
#
-import Tix
+import tkinter.tix
def RunSample(w):
global root
@@ -21,20 +21,20 @@ def RunSample(w):
# We use these options to set the sizes of the subwidgets inside the
# notebook, so that they are well-aligned on the screen.
- prefix = Tix.OptionName(w)
+ prefix = tkinter.tix.OptionName(w)
if prefix:
prefix = '*'+prefix
else:
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)
+ w.option_add(prefix+'*TixControl*label.anchor', tkinter.tix.E)
w.option_add(prefix+'*TixNoteBook*tagPadX', 8)
# Create the notebook widget and set its backpagecolor to gray.
# Note that the -backpagecolor option belongs to the "nbframe"
# subwidget.
- nb = Tix.NoteBook(w, name='nb', ipadx=6, ipady=6)
+ nb = tkinter.tix.NoteBook(w, name='nb', ipadx=6, ipady=6)
nb['bg'] = 'gray'
nb.nbframe['backpagecolor'] = 'gray'
@@ -45,7 +45,7 @@ def RunSample(w):
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)
+ nb.pack(expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5 ,side=tkinter.tix.TOP)
#----------------------------------------
# Create the first page
@@ -54,21 +54,21 @@ def RunSample(w):
# other widgets
#
tab=nb.hard_disk
- f = Tix.Frame(tab)
- common = Tix.Frame(tab)
+ f = tkinter.tix.Frame(tab)
+ common = tkinter.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)
+ f.pack(side=tkinter.tix.LEFT, padx=2, pady=2, fill=tkinter.tix.BOTH, expand=1)
+ common.pack(side=tkinter.tix.RIGHT, padx=2, fill=tkinter.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 = tkinter.tix.Control(f, value=12, label='Access time: ')
+ w = tkinter.tix.Control(f, value=400, label='Write Throughput: ')
+ r = tkinter.tix.Control(f, value=400, label='Read Throughput: ')
+ c = tkinter.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)
+ a.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ w.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ r.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ c.pack(side=tkinter.tix.TOP, padx=20, pady=2)
# Create the common buttons
createCommonButtons(common)
@@ -79,23 +79,23 @@ def RunSample(w):
tab = nb.network
- f = Tix.Frame(tab)
- common = Tix.Frame(tab)
+ f = tkinter.tix.Frame(tab)
+ common = tkinter.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)
+ f.pack(side=tkinter.tix.LEFT, padx=2, pady=2, fill=tkinter.tix.BOTH, expand=1)
+ common.pack(side=tkinter.tix.RIGHT, padx=2, fill=tkinter.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 = tkinter.tix.Control(f, value=12, label='Access time: ')
+ w = tkinter.tix.Control(f, value=400, label='Write Throughput: ')
+ r = tkinter.tix.Control(f, value=400, label='Read Throughput: ')
+ c = tkinter.tix.Control(f, value=1021, label='Capacity: ')
+ u = tkinter.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)
+ a.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ w.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ r.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ c.pack(side=tkinter.tix.TOP, padx=20, pady=2)
+ u.pack(side=tkinter.tix.TOP, padx=20, pady=2)
createCommonButtons(common)
@@ -104,16 +104,16 @@ def doDestroy():
root.destroy()
def createCommonButtons(master):
- ok = Tix.Button(master, name='ok', text='OK', width=6,
+ ok = tkinter.tix.Button(master, name='ok', text='OK', width=6,
command=doDestroy)
- cancel = Tix.Button(master, name='cancel',
+ cancel = tkinter.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)
+ ok.pack(side=tkinter.tix.TOP, padx=2, pady=2)
+ cancel.pack(side=tkinter.tix.TOP, padx=2, pady=2)
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()
diff --git a/Demo/tix/samples/OptMenu.py b/Demo/tix/samples/OptMenu.py
index 1d39420..d1dd46d 100755
--- a/Demo/tix/samples/OptMenu.py
+++ b/Demo/tix/samples/OptMenu.py
@@ -13,7 +13,7 @@
# This file demonstrates the use of the tixOptionMenu widget -- you can
# use it for the user to choose from a fixed set of options
#
-import Tix
+import tkinter.tix
options = {'text':'Plain Text', 'post':'PostScript', 'html':'HTML',
'tex':'LaTeX', 'rtf':'Rich Text Format'}
@@ -21,16 +21,16 @@ options = {'text':'Plain Text', 'post':'PostScript', 'html':'HTML',
def RunSample(w):
global demo_opt_from, demo_opt_to
- demo_opt_from = Tix.StringVar()
- demo_opt_to = Tix.StringVar()
+ demo_opt_from = tkinter.tix.StringVar()
+ demo_opt_to = tkinter.tix.StringVar()
- top = Tix.Frame(w, bd=1, relief=Tix.RAISED)
+ top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED)
- from_file = Tix.OptionMenu(top, label="From File Format : ",
+ from_file = tkinter.tix.OptionMenu(top, label="From File Format : ",
variable=demo_opt_from,
options = 'label.width 19 label.anchor e menubutton.width 15')
- to_file = Tix.OptionMenu(top, label="To File Format : ",
+ to_file = tkinter.tix.OptionMenu(top, label="To File Format : ",
variable=demo_opt_to,
options='label.width 19 label.anchor e menubutton.width 15')
@@ -47,22 +47,22 @@ def RunSample(w):
demo_opt_from.set('html')
demo_opt_to.set('post')
- from_file.pack(side=Tix.TOP, anchor=Tix.W, pady=3, padx=6)
- to_file.pack(side=Tix.TOP, anchor=Tix.W, pady=3, padx=6)
+ from_file.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W, pady=3, padx=6)
+ to_file.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W, pady=3, padx=6)
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='Ok', underline=0, width=6,
command=lambda w=w: ok_command(w))
box.add('cancel', text='Cancel', underline=0, width=6,
command=lambda w=w: w.destroy())
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
- top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
def ok_command(w):
# tixDemo:Status "Convert file from %s to %s" % ( demo_opt_from.get(), demo_opt_to.get())
w.destroy()
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()
diff --git a/Demo/tix/samples/PanedWin.py b/Demo/tix/samples/PanedWin.py
index 3efc731..1ffc470 100755
--- a/Demo/tix/samples/PanedWin.py
+++ b/Demo/tix/samples/PanedWin.py
@@ -15,7 +15,7 @@
# of artical names and the size of the text widget that shows the body
# of the article.
-import Tix
+import tkinter.tix
TCL_ALL_EVENTS = 0
@@ -32,30 +32,30 @@ class DemoPanedwin:
z = w.winfo_toplevel()
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
- group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
+ group = tkinter.tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
group.entry.insert(0,'comp.lang.python')
- pane = Tix.PanedWindow(w, orientation='vertical')
+ pane = tkinter.tix.PanedWindow(w, orientation='vertical')
p1 = pane.add('list', min=70, size=100)
p2 = pane.add('text', min=70)
- list = Tix.ScrolledListBox(p1)
+ list = tkinter.tix.ScrolledListBox(p1)
list.listbox['width'] = 80
list.listbox['height'] = 5
- text = Tix.ScrolledText(p2)
+ text = tkinter.tix.ScrolledText(p2)
text.text['width'] = 80
text.text['height'] = 20
- list.listbox.insert(Tix.END, " 12324 Re: Tkinter is good for your health")
- list.listbox.insert(Tix.END, "+ 12325 Re: Tkinter is good for your health")
- list.listbox.insert(Tix.END, "+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)")
- list.listbox.insert(Tix.END, " 12327 Re: Tix is even better for your health (Was: Tkinter is good...)")
- list.listbox.insert(Tix.END, "+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)")
- list.listbox.insert(Tix.END, " 12329 Re: Tix is even better for your health (Was: Tkinter is good...)")
- list.listbox.insert(Tix.END, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)")
+ list.listbox.insert(tkinter.tix.END, " 12324 Re: Tkinter is good for your health")
+ list.listbox.insert(tkinter.tix.END, "+ 12325 Re: Tkinter is good for your health")
+ list.listbox.insert(tkinter.tix.END, "+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)")
+ list.listbox.insert(tkinter.tix.END, " 12327 Re: Tix is even better for your health (Was: Tkinter is good...)")
+ list.listbox.insert(tkinter.tix.END, "+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)")
+ list.listbox.insert(tkinter.tix.END, " 12329 Re: Tix is even better for your health (Was: Tkinter is good...)")
+ list.listbox.insert(tkinter.tix.END, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)")
text.text['bg'] = list.listbox['bg']
text.text['wrap'] = 'none'
- text.text.insert(Tix.END, """
+ text.text.insert(tkinter.tix.END, """
Mon, 19 Jun 1995 11:39:52 comp.lang.python Thread 34 of 220
Lines 353 A new way to put text and bitmaps together iNo responses
ioi@blue.seas.upenn.edu Ioi K. Lam at University of Pennsylvania
@@ -70,18 +70,18 @@ class DemoPanedwin:
""")
text.text['state'] = 'disabled'
- list.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6)
- text.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6)
+ list.pack(expand=1, fill=tkinter.tix.BOTH, padx=4, pady=6)
+ text.pack(expand=1, fill=tkinter.tix.BOTH, padx=4, pady=6)
- group.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
- pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1)
+ group.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH)
+ pane.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH, expand=1)
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='Ok', underline=0, width=6,
command=self.quitcmd)
box.add('cancel', text='Cancel', underline=0, width=6,
command=self.quitcmd)
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
def quitcmd (self):
self.exit = 0
@@ -94,5 +94,5 @@ class DemoPanedwin:
self.root.destroy()
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
diff --git a/Demo/tix/samples/PopMenu.py b/Demo/tix/samples/PopMenu.py
index 32f3229..cb75d85 100755
--- a/Demo/tix/samples/PopMenu.py
+++ b/Demo/tix/samples/PopMenu.py
@@ -12,18 +12,18 @@
# This file demonstrates the use of the tixPopupMenu widget.
#
-import Tix
+import tkinter.tix
def RunSample(w):
# We create the frame and the button, then we'll bind the PopupMenu
# to both widgets. The result is, when you press the right mouse
# button over $w.top or $w.top.but, the PopupMenu will come up.
#
- top = Tix.Frame(w, relief=Tix.RAISED, bd=1)
- but = Tix.Button(top, text='Press the right mouse button over this button or its surrounding area')
- but.pack(expand=1, fill=Tix.BOTH, padx=50, pady=50)
+ top = tkinter.tix.Frame(w, relief=tkinter.tix.RAISED, bd=1)
+ but = tkinter.tix.Button(top, text='Press the right mouse button over this button or its surrounding area')
+ but.pack(expand=1, fill=tkinter.tix.BOTH, padx=50, pady=50)
- p = Tix.PopupMenu(top, title='Popup Test')
+ p = tkinter.tix.PopupMenu(top, title='Popup Test')
p.bind_widget(top)
p.bind_widget(but)
@@ -37,21 +37,21 @@ def RunSample(w):
p.menu.add_command(label='Find', underline=0)
p.menu.add_command(label='System', underline=1)
p.menu.add_command(label='Help', underline=0)
- m1 = Tix.Menu(p.menu)
+ m1 = tkinter.tix.Menu(p.menu)
m1.add_command(label='Hello')
p.menu.add_cascade(label='More', menu=m1)
- but.pack(side=Tix.TOP, padx=40, pady=50)
+ but.pack(side=tkinter.tix.TOP, padx=40, pady=50)
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='Ok', underline=0, width=6,
command=lambda w=w: w.destroy())
box.add('cancel', text='Cancel', underline=0, width=6,
command=lambda w=w: w.destroy())
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
- top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()
diff --git a/Demo/tix/samples/SHList1.py b/Demo/tix/samples/SHList1.py
index 7ca7b3e..bf46020 100755
--- a/Demo/tix/samples/SHList1.py
+++ b/Demo/tix/samples/SHList1.py
@@ -13,7 +13,7 @@
# This file demonstrates the use of the tixScrolledHList widget.
#
-import Tix
+import tkinter.tix
TCL_ALL_EVENTS = 0
@@ -33,13 +33,13 @@ class DemoSHList:
# We create the frame and the ScrolledHList widget
# at the top of the dialog box
#
- top = Tix.Frame( w, relief=Tix.RAISED, bd=1)
+ top = tkinter.tix.Frame( w, relief=tkinter.tix.RAISED, bd=1)
# Put a simple hierachy into the HList (two levels). Use colors and
# separator widgets (frames) to make the list look fancy
#
- top.a = Tix.ScrolledHList(top)
- top.a.pack( expand=1, fill=Tix.BOTH, padx=10, pady=10, side=Tix.TOP)
+ top.a = tkinter.tix.ScrolledHList(top)
+ top.a.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP)
# This is our little relational database
#
@@ -68,13 +68,13 @@ class DemoSHList:
count=0
for boss,name in bosses :
if count :
- f=Tix.Frame(hlist, name='sep%d' % count, height=2, width=150,
- bd=2, relief=Tix.SUNKEN )
+ f=tkinter.tix.Frame(hlist, name='sep%d' % count, height=2, width=150,
+ bd=2, relief=tkinter.tix.SUNKEN )
- hlist.add_child( itemtype=Tix.WINDOW,
- window=f, state=Tix.DISABLED )
+ hlist.add_child( itemtype=tkinter.tix.WINDOW,
+ window=f, state=tkinter.tix.DISABLED )
- hlist.add(boss, itemtype=Tix.TEXT, text=name)
+ hlist.add(boss, itemtype=tkinter.tix.TEXT, text=name)
count = count+1
@@ -99,15 +99,15 @@ class DemoSHList:
# Use a ButtonBox to hold the buttons.
#
- box= Tix.ButtonBox(top, orientation=Tix.HORIZONTAL )
+ box= tkinter.tix.ButtonBox(top, orientation=tkinter.tix.HORIZONTAL )
box.add( 'ok', text='Ok', underline=0, width=6,
command = self.okcmd)
box.add( 'cancel', text='Cancel', underline=0, width=6,
command = self.quitcmd)
- box.pack( side=Tix.BOTTOM, fill=Tix.X)
- top.pack( side=Tix.TOP, fill=Tix.BOTH, expand=1 )
+ box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack( side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1 )
def okcmd (self):
self.quitcmd()
@@ -127,5 +127,5 @@ class DemoSHList:
# outside of the main demo program "tixwidgets.py".
#
if __name__== '__main__' :
- root=Tix.Tk()
+ root=tkinter.tix.Tk()
RunSample(root)
diff --git a/Demo/tix/samples/SHList2.py b/Demo/tix/samples/SHList2.py
index 17fd551..370c765 100755
--- a/Demo/tix/samples/SHList2.py
+++ b/Demo/tix/samples/SHList2.py
@@ -16,7 +16,7 @@
# In a tixHList widget, you can have one ore more columns.
#
-import Tix
+import tkinter.tix
TCL_ALL_EVENTS = 0
@@ -36,13 +36,13 @@ class DemoSHList:
# We create the frame and the ScrolledHList widget
# at the top of the dialog box
#
- top = Tix.Frame( w, relief=Tix.RAISED, bd=1)
+ top = tkinter.tix.Frame( w, relief=tkinter.tix.RAISED, bd=1)
# Put a simple hierachy into the HList (two levels). Use colors and
# separator widgets (frames) to make the list look fancy
#
- top.a = Tix.ScrolledHList(top, options='hlist.columns 3 hlist.header 1' )
- top.a.pack( expand=1, fill=Tix.BOTH, padx=10, pady=10, side=Tix.TOP)
+ top.a = tkinter.tix.ScrolledHList(top, options='hlist.columns 3 hlist.header 1' )
+ top.a.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP)
hlist=top.a.hlist
@@ -55,12 +55,12 @@ class DemoSHList:
# First some styles for the headers
style={}
- style['header'] = Tix.DisplayStyle(Tix.TEXT, refwindow=hlist,
- anchor=Tix.CENTER, padx=8, pady=2, font = boldfont )
+ style['header'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist,
+ anchor=tkinter.tix.CENTER, padx=8, pady=2, font = boldfont )
- hlist.header_create(0, itemtype=Tix.TEXT, text='Name',
+ hlist.header_create(0, itemtype=tkinter.tix.TEXT, text='Name',
style=style['header'])
- hlist.header_create(1, itemtype=Tix.TEXT, text='Position',
+ hlist.header_create(1, itemtype=tkinter.tix.TEXT, text='Position',
style=style['header'])
# Notice that we use 3 columns in the hlist widget. This way when the user
@@ -90,13 +90,13 @@ class DemoSHList:
('chuck', 'jeff', 'Chuck McLean', 'Cleaner')
]
- style['mgr_name'] = Tix.DisplayStyle(Tix.TEXT, refwindow=hlist)
+ style['mgr_name'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist)
- style['mgr_posn'] = Tix.DisplayStyle(Tix.TEXT, padx=8, refwindow=hlist)
+ style['mgr_posn'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, padx=8, refwindow=hlist)
- style['empl_name'] = Tix.DisplayStyle(Tix.TEXT, refwindow=hlist)
+ style['empl_name'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist)
- style['empl_posn'] = Tix.DisplayStyle(Tix.TEXT, padx=8, refwindow=hlist)
+ style['empl_posn'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, padx=8, refwindow=hlist)
# Let configure the appearance of the HList subwidget
#
@@ -105,9 +105,9 @@ class DemoSHList:
# Create the boss
#
- hlist.add ('.', itemtype=Tix.TEXT, text=boss[1],
+ hlist.add ('.', itemtype=tkinter.tix.TEXT, text=boss[1],
style=style['mgr_name'])
- hlist.item_create('.', 1, itemtype=Tix.TEXT, text=boss[2],
+ hlist.item_create('.', 1, itemtype=tkinter.tix.TEXT, text=boss[2],
style=style['mgr_posn'])
# Create the managers
@@ -115,9 +115,9 @@ class DemoSHList:
for key,name,posn in managers :
e= '.'+ key
- hlist.add(e, itemtype=Tix.TEXT, text=name,
+ hlist.add(e, itemtype=tkinter.tix.TEXT, text=name,
style=style['mgr_name'])
- hlist.item_create(e, 1, itemtype=Tix.TEXT, text=posn,
+ hlist.item_create(e, 1, itemtype=tkinter.tix.TEXT, text=posn,
style=style['mgr_posn'])
@@ -130,21 +130,21 @@ class DemoSHList:
# parent entryPath / child's name
hlist.add(entrypath, text=name, style=style['empl_name'])
- hlist.item_create(entrypath, 1, itemtype=Tix.TEXT,
+ hlist.item_create(entrypath, 1, itemtype=tkinter.tix.TEXT,
text = posn, style = style['empl_posn'] )
# Use a ButtonBox to hold the buttons.
#
- box= Tix.ButtonBox(top, orientation=Tix.HORIZONTAL )
+ box= tkinter.tix.ButtonBox(top, orientation=tkinter.tix.HORIZONTAL )
box.add( 'ok', text='Ok', underline=0, width=6,
command = self.okcmd )
box.add( 'cancel', text='Cancel', underline=0, width=6,
command = self.quitcmd )
- box.pack( side=Tix.BOTTOM, fill=Tix.X)
- top.pack( side=Tix.TOP, fill=Tix.BOTH, expand=1 )
+ box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack( side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1 )
def okcmd (self):
self.quitcmd()
@@ -164,5 +164,5 @@ class DemoSHList:
# outside of the main demo program "tixwidgets.py".
#
if __name__== '__main__' :
- root=Tix.Tk()
+ root=tkinter.tix.Tk()
RunSample(root)
diff --git a/Demo/tix/samples/Tree.py b/Demo/tix/samples/Tree.py
index 9a7e481..e46ff60 100755
--- a/Demo/tix/samples/Tree.py
+++ b/Demo/tix/samples/Tree.py
@@ -14,30 +14,30 @@
# dynamic hierachical data (the files in the Unix file system)
#
-import Tix, os
+import tkinter.tix, os
def RunSample(w):
- top = Tix.Frame(w, relief=Tix.RAISED, bd=1)
- tree = Tix.Tree(top, options='separator "/"')
- tree.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10, side=Tix.LEFT)
+ top = tkinter.tix.Frame(w, relief=tkinter.tix.RAISED, bd=1)
+ tree = tkinter.tix.Tree(top, options='separator "/"')
+ tree.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.LEFT)
tree['opencmd'] = lambda dir=None, w=tree: opendir(w, dir)
# The / directory is added in the "open" mode. The user can open it
# and then browse its subdirectories ...
adddir(tree, "/")
- box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
+ box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
box.add('ok', text='Ok', underline=0, command=w.destroy, width=6)
box.add('cancel', text='Cancel', underline=0, command=w.destroy, width=6)
- box.pack(side=Tix.BOTTOM, fill=Tix.X)
- top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
+ box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
+ top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
def adddir(tree, dir):
if dir == '/':
text = '/'
else:
text = os.path.basename(dir)
- tree.hlist.add(dir, itemtype=Tix.IMAGETEXT, text=text,
+ tree.hlist.add(dir, itemtype=tkinter.tix.IMAGETEXT, text=text,
image=tree.tk.call('tix', 'getimage', 'folder'))
try:
os.listdir(dir)
@@ -71,10 +71,10 @@ def opendir(tree, dir):
if os.path.isdir(dir + '/' + file):
adddir(tree, dir + '/' + file)
else:
- tree.hlist.add(dir + '/' + file, itemtype=Tix.IMAGETEXT, text=file,
+ tree.hlist.add(dir + '/' + file, itemtype=tkinter.tix.IMAGETEXT, text=file,
image=tree.tk.call('tix', 'getimage', 'file'))
if __name__ == '__main__':
- root = Tix.Tk()
+ root = tkinter.tix.Tk()
RunSample(root)
root.mainloop()