diff options
76 files changed, 542 insertions, 542 deletions
diff --git a/Demo/tix/grid.py b/Demo/tix/grid.py index 79b8886..4268f07 100644 --- a/Demo/tix/grid.py +++ b/Demo/tix/grid.py @@ -1,5 +1,5 @@ ### -import Tix as tk +import tkinter.tix as tk from pprint import pprint r= tk.Tk() 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() diff --git a/Demo/tix/tixwidgets.py b/Demo/tix/tixwidgets.py index 49d1e7f..42bcedc 100644 --- a/Demo/tix/tixwidgets.py +++ b/Demo/tix/tixwidgets.py @@ -12,9 +12,9 @@ # % python tixwidgets.py # -import os, os.path, sys, Tix -from Tkconstants import * -import traceback, tkMessageBox +import os, os.path, sys, tkinter.tix +from tkinter.constants import * +import traceback, tkinter.messagebox TCL_DONT_WAIT = 1<<1 TCL_WINDOW_EVENTS = 1<<2 @@ -30,7 +30,7 @@ class Demo: self.dir = None # script directory self.balloon = None # balloon widget - self.useBalloons = Tix.StringVar() + self.useBalloons = tkinter.tix.StringVar() self.useBalloons.set('0') self.statusbar = None # status bar widget self.welmsg = None # Msg widget @@ -56,14 +56,14 @@ class Demo: def MkMainMenu(self): top = self.root - w = Tix.Frame(top, bd=2, relief=RAISED) - file = Tix.Menubutton(w, text='File', underline=0, takefocus=0) - help = Tix.Menubutton(w, text='Help', underline=0, takefocus=0) + w = tkinter.tix.Frame(top, bd=2, relief=RAISED) + file = tkinter.tix.Menubutton(w, text='File', underline=0, takefocus=0) + help = tkinter.tix.Menubutton(w, text='Help', underline=0, takefocus=0) file.pack(side=LEFT) help.pack(side=RIGHT) - fm = Tix.Menu(file, tearoff=0) + fm = tkinter.tix.Menu(file, tearoff=0) file['menu'] = fm - hm = Tix.Menu(help, tearoff=0) + hm = tkinter.tix.Menu(help, tearoff=0) help['menu'] = hm fm.add_command(label='Exit', underline=1, @@ -77,7 +77,7 @@ class Demo: def MkMainNotebook(self): top = self.root - w = Tix.NoteBook(top, ipadx=5, ipady=5, options=""" + w = tkinter.tix.NoteBook(top, ipadx=5, ipady=5, options=""" tagPadX 6 tagPadY 4 borderWidth 2 @@ -103,8 +103,8 @@ class Demo: global demo top = self.root - w = Tix.Frame(top, relief=Tix.RAISED, bd=1) - demo.statusbar = Tix.Label(w, relief=Tix.SUNKEN, bd=1) + w = tkinter.tix.Frame(top, relief=tkinter.tix.RAISED, bd=1) + demo.statusbar = tkinter.tix.Label(w, relief=tkinter.tix.SUNKEN, bd=1) demo.statusbar.form(padx=3, pady=3, left=0, right='%70') return w @@ -116,7 +116,7 @@ class Demo: z.geometry('790x590+10+10') else: z.geometry('890x640+10+10') - demo.balloon = Tix.Balloon(root) + demo.balloon = tkinter.tix.Balloon(root) frame1 = self.MkMainMenu() frame2 = self.MkMainNotebook() frame3 = self.MkMainStatus() @@ -152,7 +152,7 @@ class Demo: self.exit = 1 return except KeyboardInterrupt: - if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes': + if tkinter.messagebox.askquestion ('Interrupt', 'Really Quit?') == 'yes': # self.tk.eval('exit') self.exit = 1 return @@ -163,7 +163,7 @@ class Demo: text = "" for line in traceback.format_exception(t,v,tb): text += line + '\n' - try: tkMessageBox.showerror ('Error', text) + try: tkinter.messagebox.showerror ('Error', text) except: pass self.exit = 1 raise SystemExit(1) @@ -191,9 +191,9 @@ def MkWelcome(nb, name): def MkWelcomeBar(top): global demo - w = Tix.Frame(top, bd=2, relief=Tix.GROOVE) - b1 = Tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) - b2 = Tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) + w = tkinter.tix.Frame(top, bd=2, relief=tkinter.tix.GROOVE) + b1 = tkinter.tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) + b2 = tkinter.tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) b1.entry['width'] = 15 b1.slistbox.listbox['height'] = 3 b2.entry['width'] = 4 @@ -202,22 +202,22 @@ def MkWelcomeBar(top): demo.welfont = b1 demo.welsize = b2 - b1.insert(Tix.END, 'Courier') - b1.insert(Tix.END, 'Helvetica') - b1.insert(Tix.END, 'Lucida') - b1.insert(Tix.END, 'Times Roman') + b1.insert(tkinter.tix.END, 'Courier') + b1.insert(tkinter.tix.END, 'Helvetica') + b1.insert(tkinter.tix.END, 'Lucida') + b1.insert(tkinter.tix.END, 'Times Roman') - b2.insert(Tix.END, '8') - b2.insert(Tix.END, '10') - b2.insert(Tix.END, '12') - b2.insert(Tix.END, '14') - b2.insert(Tix.END, '18') + b2.insert(tkinter.tix.END, '8') + b2.insert(tkinter.tix.END, '10') + b2.insert(tkinter.tix.END, '12') + b2.insert(tkinter.tix.END, '14') + b2.insert(tkinter.tix.END, '18') b1.pick(1) b2.pick(3) - b1.pack(side=Tix.LEFT, padx=4, pady=4) - b2.pack(side=Tix.LEFT, padx=4, pady=4) + b1.pack(side=tkinter.tix.LEFT, padx=4, pady=4) + b2.pack(side=tkinter.tix.LEFT, padx=4, pady=4) demo.balloon.bind_widget(b1, msg='Choose\na font', statusmsg='Choose a font for this page') @@ -228,20 +228,20 @@ def MkWelcomeBar(top): def MkWelcomeText(top): global demo - w = Tix.ScrolledWindow(top, scrollbar='auto') + w = tkinter.tix.ScrolledWindow(top, scrollbar='auto') win = w.window text = 'Welcome to TIX in Python' - title = Tix.Label(win, - bd=0, width=30, anchor=Tix.N, text=text) - msg = Tix.Message(win, - bd=0, width=400, anchor=Tix.N, + title = tkinter.tix.Label(win, + bd=0, width=30, anchor=tkinter.tix.N, text=text) + msg = tkinter.tix.Message(win, + bd=0, width=400, anchor=tkinter.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\ For more information, see http://tix.sourceforge.net.') - title.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10) - msg.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10) + title.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10) + msg.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10) demo.welmsg = msg return w @@ -267,14 +267,14 @@ def MkChoosers(nb, name): w = nb.page(name) options = "label.padX 4" - til = Tix.LabelFrame(w, label='Chooser Widgets', options=options) - cbx = Tix.LabelFrame(w, label='tixComboBox', options=options) - ctl = Tix.LabelFrame(w, label='tixControl', options=options) - sel = Tix.LabelFrame(w, label='tixSelect', options=options) - opt = Tix.LabelFrame(w, label='tixOptionMenu', options=options) - fil = Tix.LabelFrame(w, label='tixFileEntry', options=options) - fbx = Tix.LabelFrame(w, label='tixFileSelectBox', options=options) - tbr = Tix.LabelFrame(w, label='Tool Bar', options=options) + til = tkinter.tix.LabelFrame(w, label='Chooser Widgets', options=options) + cbx = tkinter.tix.LabelFrame(w, label='tixComboBox', options=options) + ctl = tkinter.tix.LabelFrame(w, label='tixControl', options=options) + sel = tkinter.tix.LabelFrame(w, label='tixSelect', options=options) + opt = tkinter.tix.LabelFrame(w, label='tixOptionMenu', options=options) + fil = tkinter.tix.LabelFrame(w, label='tixFileEntry', options=options) + fbx = tkinter.tix.LabelFrame(w, label='tixFileSelectBox', options=options) + tbr = tkinter.tix.LabelFrame(w, label='Tool Bar', options=options) MkTitle(til.frame) MkCombo(cbx.frame) @@ -301,38 +301,38 @@ def MkChoosers(nb, name): fbx.form(right=-1, top=0, left='%66') def MkCombo(w): - options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 14) - - 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) - static.insert(Tix.END, 'January') - static.insert(Tix.END, 'February') - static.insert(Tix.END, 'March') - static.insert(Tix.END, 'April') - static.insert(Tix.END, 'May') - static.insert(Tix.END, 'June') - static.insert(Tix.END, 'July') - static.insert(Tix.END, 'August') - static.insert(Tix.END, 'September') - static.insert(Tix.END, 'October') - static.insert(Tix.END, 'November') - static.insert(Tix.END, 'December') - - editable.insert(Tix.END, 'Angola') - editable.insert(Tix.END, 'Bangladesh') - editable.insert(Tix.END, 'China') - editable.insert(Tix.END, 'Denmark') - editable.insert(Tix.END, 'Ecuador') - - history.insert(Tix.END, '/usr/bin/ksh') - history.insert(Tix.END, '/usr/local/lib/python') - history.insert(Tix.END, '/var/adm') - - static.pack(side=Tix.TOP, padx=5, pady=3) - editable.pack(side=Tix.TOP, padx=5, pady=3) - history.pack(side=Tix.TOP, padx=5, pady=3) + options="label.width %d label.anchor %s entry.width %d" % (10, tkinter.tix.E, 14) + + static = tkinter.tix.ComboBox(w, label='Static', editable=0, options=options) + editable = tkinter.tix.ComboBox(w, label='Editable', editable=1, options=options) + history = tkinter.tix.ComboBox(w, label='History', editable=1, history=1, + anchor=tkinter.tix.E, options=options) + static.insert(tkinter.tix.END, 'January') + static.insert(tkinter.tix.END, 'February') + static.insert(tkinter.tix.END, 'March') + static.insert(tkinter.tix.END, 'April') + static.insert(tkinter.tix.END, 'May') + static.insert(tkinter.tix.END, 'June') + static.insert(tkinter.tix.END, 'July') + static.insert(tkinter.tix.END, 'August') + static.insert(tkinter.tix.END, 'September') + static.insert(tkinter.tix.END, 'October') + static.insert(tkinter.tix.END, 'November') + static.insert(tkinter.tix.END, 'December') + + editable.insert(tkinter.tix.END, 'Angola') + editable.insert(tkinter.tix.END, 'Bangladesh') + editable.insert(tkinter.tix.END, 'China') + editable.insert(tkinter.tix.END, 'Denmark') + editable.insert(tkinter.tix.END, 'Ecuador') + + history.insert(tkinter.tix.END, '/usr/bin/ksh') + history.insert(tkinter.tix.END, '/usr/local/lib/python') + history.insert(tkinter.tix.END, '/var/adm') + + static.pack(side=tkinter.tix.TOP, padx=5, pady=3) + editable.pack(side=tkinter.tix.TOP, padx=5, pady=3) + history.pack(side=tkinter.tix.TOP, padx=5, pady=3) states = ['Bengal', 'Delhi', 'Karnataka', 'Tamil Nadu'] @@ -359,30 +359,30 @@ def spin_validate(w): def MkControl(w): global demo_spintxt - options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 13) + options="label.width %d label.anchor %s entry.width %d" % (10, tkinter.tix.E, 13) - demo_spintxt = Tix.StringVar() + demo_spintxt = tkinter.tix.StringVar() demo_spintxt.set(states[0]) - simple = Tix.Control(w, label='Numbers', options=options) - spintxt = Tix.Control(w, label='States', variable=demo_spintxt, + simple = tkinter.tix.Control(w, label='Numbers', options=options) + spintxt = tkinter.tix.Control(w, label='States', variable=demo_spintxt, options=options) spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1) spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1) spintxt['validatecmd'] = lambda w=spintxt: spin_validate(w) - simple.pack(side=Tix.TOP, padx=5, pady=3) - spintxt.pack(side=Tix.TOP, padx=5, pady=3) + simple.pack(side=tkinter.tix.TOP, padx=5, pady=3) + spintxt.pack(side=tkinter.tix.TOP, padx=5, pady=3) def MkSelect(w): - options = "label.anchor %s" % Tix.CENTER + options = "label.anchor %s" % tkinter.tix.CENTER - sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1, - orientation=Tix.VERTICAL, - labelside=Tix.TOP, + sel1 = tkinter.tix.Select(w, label='Mere Mortals', allowzero=1, radio=1, + orientation=tkinter.tix.VERTICAL, + labelside=tkinter.tix.TOP, options=options) - sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0, - orientation=Tix.VERTICAL, - labelside= Tix.TOP, + sel2 = tkinter.tix.Select(w, label='Geeks', allowzero=1, radio=0, + orientation=tkinter.tix.VERTICAL, + labelside= tkinter.tix.TOP, options=options) sel1.add('eat', text='Eat') @@ -397,13 +397,13 @@ def MkSelect(w): sel2.add('prog3', text='Program') sel2.add('sleep', text='Sleep') - sel1.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X) - sel2.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X) + sel1.pack(side=tkinter.tix.LEFT, padx=5, pady=3, fill=tkinter.tix.X) + sel2.pack(side=tkinter.tix.LEFT, padx=5, pady=3, fill=tkinter.tix.X) def MkOptMenu(w): - options='menubutton.width 15 label.anchor %s' % Tix.E + options='menubutton.width 15 label.anchor %s' % tkinter.tix.E - m = Tix.OptionMenu(w, label='File Format : ', options=options) + m = tkinter.tix.OptionMenu(w, label='File Format : ', options=options) m.add_command('text', label='Plain Text') m.add_command('post', label='PostScript') m.add_command('format', label='Formatted Text') @@ -412,27 +412,27 @@ def MkOptMenu(w): m.add_command('tex', label='LaTeX') m.add_command('rtf', label='Rich Text Format') - m.pack(fill=Tix.X, padx=5, pady=3) + m.pack(fill=tkinter.tix.X, padx=5, pady=3) def MkFileEnt(w): - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) + ent = tkinter.tix.FileEntry(w, label='Select a file : ') + msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) + ent.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3) def MkFileBox(w): """The 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. """ - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) + box = tkinter.tix.FileSelectBox(w) + msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) + box.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3) def MkToolBar(w): """The Select widget is also good for arranging buttons in a tool bar. @@ -441,12 +441,12 @@ def MkToolBar(w): options='frame.borderWidth 1' - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) + bar = tkinter.tix.Frame(w, bd=2, relief=tkinter.tix.RAISED) + font = tkinter.tix.Select(w, allowzero=1, radio=0, label='', options=options) + para = tkinter.tix.Select(w, allowzero=0, radio=1, label='', options=options) font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm') font.add('italic', bitmap='@' + demo.dir + '/bitmaps/italic.xbm') @@ -458,24 +458,24 @@ def MkToolBar(w): para.add('center', bitmap='@' + demo.dir + '/bitmaps/centerj.xbm') para.add('justify', bitmap='@' + demo.dir + '/bitmaps/justify.xbm') - msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) - bar.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3) - font.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3) - para.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3) + msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) + bar.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3) + font.pack({'in':bar}, side=tkinter.tix.LEFT, padx=3, pady=3) + para.pack({'in':bar}, side=tkinter.tix.LEFT, padx=3, pady=3) def MkTitle(w): - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) + msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) def MkScroll(nb, name): w = nb.page(name) options='label.padX 4' - sls = Tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options) - swn = Tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options) - stx = Tix.LabelFrame(w, label='Tix.ScrolledText', options=options) + sls = tkinter.tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options) + swn = tkinter.tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options) + stx = tkinter.tix.LabelFrame(w, label='Tix.ScrolledText', options=options) MkSList(sls.frame) MkSWindow(swn.frame) @@ -490,31 +490,31 @@ def MkSList(w): """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. """ - top = Tix.Frame(w, width=300, height=330) - bot = Tix.Frame(w) - msg = Tix.Message(top, - relief=Tix.FLAT, width=200, anchor=Tix.N, + top = tkinter.tix.Frame(w, width=300, height=330) + bot = tkinter.tix.Frame(w) + msg = tkinter.tix.Message(top, + relief=tkinter.tix.FLAT, width=200, anchor=tkinter.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 = tkinter.tix.ScrolledListBox(top, scrollbar='auto') list.place(x=50, y=150, width=120, height=80) - list.listbox.insert(Tix.END, 'Alabama') - list.listbox.insert(Tix.END, 'California') - list.listbox.insert(Tix.END, 'Montana') - list.listbox.insert(Tix.END, 'New Jersey') - list.listbox.insert(Tix.END, 'New York') - list.listbox.insert(Tix.END, 'Pennsylvania') - list.listbox.insert(Tix.END, 'Washington') - - rh = Tix.ResizeHandle(top, bg='black', - relief=Tix.RAISED, + list.listbox.insert(tkinter.tix.END, 'Alabama') + list.listbox.insert(tkinter.tix.END, 'California') + list.listbox.insert(tkinter.tix.END, 'Montana') + list.listbox.insert(tkinter.tix.END, 'New Jersey') + list.listbox.insert(tkinter.tix.END, 'New York') + list.listbox.insert(tkinter.tix.END, 'Pennsylvania') + list.listbox.insert(tkinter.tix.END, 'Washington') + + rh = tkinter.tix.ResizeHandle(top, bg='black', + relief=tkinter.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)) + btn = tkinter.tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x)) top.propagate(0) - msg.pack(fill=Tix.X) - btn.pack(anchor=Tix.CENTER) - top.pack(expand=1, fill=Tix.BOTH) - bot.pack(fill=Tix.BOTH) + msg.pack(fill=tkinter.tix.X) + btn.pack(anchor=tkinter.tix.CENTER) + top.pack(expand=1, fill=tkinter.tix.BOTH) + bot.pack(fill=tkinter.tix.BOTH) list.bind('<Map>', func=lambda arg=0, rh=rh, list=list: list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list))) @@ -535,29 +535,29 @@ def MkSWindow(w): if not os.path.isfile(file): text += ' (Image missing)' - top = Tix.Frame(w, width=330, height=330) - bot = Tix.Frame(w) - msg = Tix.Message(top, - relief=Tix.FLAT, width=200, anchor=Tix.N, + top = tkinter.tix.Frame(w, width=330, height=330) + bot = tkinter.tix.Frame(w) + msg = tkinter.tix.Message(top, + relief=tkinter.tix.FLAT, width=200, anchor=tkinter.tix.N, text=text) - win = Tix.ScrolledWindow(top, scrollbar='auto') + win = tkinter.tix.ScrolledWindow(top, scrollbar='auto') image1 = win.window.image_create('photo', file=file) - lbl = Tix.Label(win.window, image=image1) - lbl.pack(expand=1, fill=Tix.BOTH) + lbl = tkinter.tix.Label(win.window, image=image1) + lbl.pack(expand=1, fill=tkinter.tix.BOTH) win.place(x=30, y=150, width=190, height=120) - rh = Tix.ResizeHandle(top, bg='black', - relief=Tix.RAISED, + rh = tkinter.tix.ResizeHandle(top, bg='black', + relief=tkinter.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)) + btn = tkinter.tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x)) top.propagate(0) - msg.pack(fill=Tix.X) - btn.pack(anchor=Tix.CENTER) - top.pack(expand=1, fill=Tix.BOTH) - bot.pack(fill=Tix.BOTH) + msg.pack(fill=tkinter.tix.X) + btn.pack(anchor=tkinter.tix.CENTER) + top.pack(expand=1, fill=tkinter.tix.BOTH) + bot.pack(fill=tkinter.tix.BOTH) win.bind('<Map>', func=lambda arg=0, rh=rh, win=win: win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win))) @@ -570,15 +570,15 @@ def SWindow_reset(rh, win): def MkSText(w): """The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.""" - top = Tix.Frame(w, width=330, height=330) - bot = Tix.Frame(w) - msg = Tix.Message(top, - relief=Tix.FLAT, width=200, anchor=Tix.N, + top = tkinter.tix.Frame(w, width=330, height=330) + bot = tkinter.tix.Frame(w) + msg = tkinter.tix.Message(top, + relief=tkinter.tix.FLAT, width=200, anchor=tkinter.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 = tkinter.tix.ScrolledText(top, scrollbar='auto') win.text['wrap'] = 'none' - win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the + win.text.insert(tkinter.tix.END, '''When -scrollbar is set to "auto", the scrollbars are shown only when needed. Additional modifiers can be used to force a scrollbar to be shown or hidden. For example, @@ -591,15 +591,15 @@ 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, + rh = tkinter.tix.ResizeHandle(top, bg='black', + relief=tkinter.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)) + btn = tkinter.tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x)) top.propagate(0) - msg.pack(fill=Tix.X) - btn.pack(anchor=Tix.CENTER) - top.pack(expand=1, fill=Tix.BOTH) - bot.pack(fill=Tix.BOTH) + msg.pack(fill=tkinter.tix.X) + btn.pack(anchor=tkinter.tix.CENTER) + top.pack(expand=1, fill=tkinter.tix.BOTH) + bot.pack(fill=tkinter.tix.BOTH) win.bind('<Map>', func=lambda arg=0, rh=rh, win=win: win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win))) @@ -612,8 +612,8 @@ def MkManager(nb, name): w = nb.page(name) options='label.padX 4' - pane = Tix.LabelFrame(w, label='Tix.PanedWindow', options=options) - note = Tix.LabelFrame(w, label='Tix.NoteBook', options=options) + pane = tkinter.tix.LabelFrame(w, label='Tix.PanedWindow', options=options) + note = tkinter.tix.LabelFrame(w, label='Tix.NoteBook', options=options) MkPanedWindow(pane.frame) MkNoteBook(note.frame) @@ -626,29 +626,29 @@ def MkPanedWindow(w): the sizes of several panes. The panes can be arranged either vertically or horizontally. """ - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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 = 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) - text = Tix.ScrolledText(p2) + list = tkinter.tix.ScrolledListBox(p1) + text = tkinter.tix.ScrolledText(p2) - 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 @@ -661,71 +661,71 @@ to form a bigger image. Then you can use this image with widgets that support the -image option. For example, you can display a text string string together with a bitmap, at the same time, inside a TK button widget. """) - 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) - msg.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH) - 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) + msg.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH) + 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) def MkNoteBook(w): - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) - options = "entry.width %d label.width %d label.anchor %s" % (10, 18, Tix.E) + options = "entry.width %d label.width %d label.anchor %s" % (10, 18, tkinter.tix.E) - nb = Tix.NoteBook(w, ipadx=6, ipady=6, options=options) + nb = tkinter.tix.NoteBook(w, ipadx=6, ipady=6, options=options) nb.add('hard_disk', label="Hard Disk", underline=0) nb.add('network', label="Network", underline=0) # Frame for the buttons that are present on all pages - common = Tix.Frame(nb.hard_disk) - common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y) + common = tkinter.tix.Frame(nb.hard_disk) + common.pack(side=tkinter.tix.RIGHT, padx=2, pady=2, fill=tkinter.tix.Y) CreateCommonButtons(common) # Widgets belonging only to this page - a = Tix.Control(nb.hard_disk, value=12, label='Access Time: ') - w = Tix.Control(nb.hard_disk, value=400, label='Write Throughput: ') - r = Tix.Control(nb.hard_disk, value=400, label='Read Throughput: ') - c = Tix.Control(nb.hard_disk, 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) - - common = Tix.Frame(nb.network) - common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y) + a = tkinter.tix.Control(nb.hard_disk, value=12, label='Access Time: ') + w = tkinter.tix.Control(nb.hard_disk, value=400, label='Write Throughput: ') + r = tkinter.tix.Control(nb.hard_disk, value=400, label='Read Throughput: ') + c = tkinter.tix.Control(nb.hard_disk, value=1021, label='Capacity: ') + 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) + + common = tkinter.tix.Frame(nb.network) + common.pack(side=tkinter.tix.RIGHT, padx=2, pady=2, fill=tkinter.tix.Y) CreateCommonButtons(common) - a = Tix.Control(nb.network, value=12, label='Access Time: ') - w = Tix.Control(nb.network, value=400, label='Write Throughput: ') - r = Tix.Control(nb.network, value=400, label='Read Throughput: ') - c = Tix.Control(nb.network, value=1021, label='Capacity: ') - u = Tix.Control(nb.network, 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 = tkinter.tix.Control(nb.network, value=12, label='Access Time: ') + w = tkinter.tix.Control(nb.network, value=400, label='Write Throughput: ') + r = tkinter.tix.Control(nb.network, value=400, label='Read Throughput: ') + c = tkinter.tix.Control(nb.network, value=1021, label='Capacity: ') + u = tkinter.tix.Control(nb.network, value=10, label='Users: ') + 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) - msg.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH) - nb.pack(side=Tix.TOP, padx=5, pady=5, fill=Tix.BOTH, expand=1) + msg.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH) + nb.pack(side=tkinter.tix.TOP, padx=5, pady=5, fill=tkinter.tix.BOTH, expand=1) def CreateCommonButtons(f): - ok = Tix.Button(f, text='OK', width = 6) - cancel = Tix.Button(f, text='Cancel', width = 6) - ok.pack(side=Tix.TOP, padx=2, pady=2) - cancel.pack(side=Tix.TOP, padx=2, pady=2) + ok = tkinter.tix.Button(f, text='OK', width = 6) + cancel = tkinter.tix.Button(f, text='Cancel', width = 6) + ok.pack(side=tkinter.tix.TOP, padx=2, pady=2) + cancel.pack(side=tkinter.tix.TOP, padx=2, pady=2) def MkDirList(nb, name): w = nb.page(name) options = "label.padX 4" - dir = Tix.LabelFrame(w, label='Tix.DirList', options=options) - fsbox = Tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options) + dir = tkinter.tix.LabelFrame(w, label='Tix.DirList', options=options) + fsbox = tkinter.tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options) MkDirListWidget(dir.frame) MkExFileWidget(fsbox.frame) dir.form(top=0, left=0, right='%40', bottom=-1) @@ -736,23 +736,23 @@ def MkDirListWidget(w): system directory and makes it easy for the user to choose and access directories. """ - msg = Tix.Message(w, - relief=Tix.FLAT, width=240, anchor=Tix.N, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) + dirlist = tkinter.tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') + msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) + dirlist.pack(side=tkinter.tix.TOP, padx=3, pady=3) 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, + msg = tkinter.tix.Message(w, + relief=tkinter.tix.FLAT, width=240, anchor=tkinter.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) - box.pack(side=Tix.TOP, padx=3, pady=3) + box = tkinter.tix.ExFileSelectBox(w, bd=2, relief=tkinter.tix.RAISED) + msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) + box.pack(side=tkinter.tix.TOP, padx=3, pady=3) ### ### List of all the demos we want to show off @@ -875,39 +875,39 @@ def MkSample(nb, name): w = nb.page(name) options = "label.padX 4" - pane = Tix.PanedWindow(w, orientation='horizontal') - pane.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH) + pane = tkinter.tix.PanedWindow(w, orientation='horizontal') + pane.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH) f1 = pane.add('list', expand='1') f2 = pane.add('text', expand='5') f1['relief'] = 'flat' f2['relief'] = 'flat' - lab = Tix.LabelFrame(f1, label='Select a sample program:') - lab.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5) - lab1 = Tix.LabelFrame(f2, label='Source:') - lab1.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5) + lab = tkinter.tix.LabelFrame(f1, label='Select a sample program:') + lab.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5) + lab1 = tkinter.tix.LabelFrame(f2, label='Source:') + lab1.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5) - slb = Tix.Tree(lab.frame, options='hlist.width 20') - slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5) + slb = tkinter.tix.Tree(lab.frame, options='hlist.width 20') + slb.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5) - stext = Tix.ScrolledText(lab1.frame, name='stext') + stext = tkinter.tix.ScrolledText(lab1.frame, name='stext') font = root.tk.eval('tix option get fixed_font') stext.text.config(font=font) - frame = Tix.Frame(lab1.frame, name='frame') + frame = tkinter.tix.Frame(lab1.frame, name='frame') - run = Tix.Button(frame, text='Run ...', name='run') - view = Tix.Button(frame, text='View Source ...', name='view') - run.pack(side=Tix.LEFT, expand=0, fill=Tix.NONE) - view.pack(side=Tix.LEFT, expand=0, fill=Tix.NONE) + run = tkinter.tix.Button(frame, text='Run ...', name='run') + view = tkinter.tix.Button(frame, text='View Source ...', name='view') + run.pack(side=tkinter.tix.LEFT, expand=0, fill=tkinter.tix.NONE) + view.pack(side=tkinter.tix.LEFT, expand=0, fill=tkinter.tix.NONE) stext.text['bg'] = slb.hlist['bg'] stext.text['state'] = 'disabled' stext.text['wrap'] = 'none' stext.text['width'] = 80 - frame.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X, padx=7) - stext.pack(side=Tix.TOP, expand=0, fill=Tix.BOTH, padx=7) + frame.pack(side=tkinter.tix.BOTTOM, expand=0, fill=tkinter.tix.X, padx=7) + stext.pack(side=tkinter.tix.TOP, expand=0, fill=tkinter.tix.BOTH, padx=7) slb.hlist['separator'] = '.' slb.hlist['width'] = 25 @@ -922,13 +922,13 @@ def MkSample(nb, name): 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', + x = tkinter.tix.Frame(slb.hlist, bd=2, height=2, width=150, + relief=tkinter.tix.SUNKEN, bg=slb.hlist['bg']) + slb.hlist.add_child(itemtype=tkinter.tix.WINDOW, window=x, state='disabled') + x = slb.hlist.add_child(itemtype=tkinter.tix.TEXT, state='disabled', text=comments[type]) for key in stypes[type]: - slb.hlist.add_child(x, itemtype=Tix.TEXT, data=key, + slb.hlist.add_child(x, itemtype=tkinter.tix.TEXT, data=key, text=key) slb.hlist.selection_clear() @@ -955,12 +955,12 @@ def Sample_Action(w, slb, stext, run, view, action): if action == 'run': exec('import ' + prog) - w = Tix.Toplevel() + w = tkinter.tix.Toplevel() w.title(title) rtn = eval(prog + '.RunSample') rtn(w) elif action == 'view': - w = Tix.Toplevel() + w = tkinter.tix.Toplevel() w.title('Source view: ' + title) LoadFile(w, demo.dir + '/samples/' + prog + '.py') elif action == 'browse': @@ -968,8 +968,8 @@ def Sample_Action(w, slb, stext, run, view, action): def LoadFile(w, fname): global root - b = Tix.Button(w, text='Close', command=w.destroy) - t = Tix.ScrolledText(w) + b = tkinter.tix.Button(w, text='Close', command=w.destroy) + t = tkinter.tix.ScrolledText(w) # b.form(left=0, bottom=0, padx=4, pady=4) # t.form(left=0, bottom=b, right='-0', top=0) t.pack() @@ -985,18 +985,18 @@ def LoadFile(w, fname): def ReadFile(w, fname): old_state = w['state'] w['state'] = 'normal' - w.delete('0.0', Tix.END) + w.delete('0.0', tkinter.tix.END) try: f = open(fname) lines = f.readlines() for s in lines: - w.insert(Tix.END, s) + w.insert(tkinter.tix.END, s) f.close() finally: # w.see('1.0') w['state'] = old_state if __name__ == '__main__': - root = Tix.Tk() + root = tkinter.tix.Tk() RunMain(root) diff --git a/Demo/tkinter/guido/AttrDialog.py b/Demo/tkinter/guido/AttrDialog.py index 921c105..5508e3b 100755 --- a/Demo/tkinter/guido/AttrDialog.py +++ b/Demo/tkinter/guido/AttrDialog.py @@ -12,7 +12,7 @@ # -- totally static, though different between PackDialog and WidgetDialog # (but even that could be unified) -from Tkinter import * +from tkinter import * class Option: diff --git a/Demo/tkinter/guido/ManPage.py b/Demo/tkinter/guido/ManPage.py index 1266f1c..a9309a3 100755 --- a/Demo/tkinter/guido/ManPage.py +++ b/Demo/tkinter/guido/ManPage.py @@ -1,9 +1,9 @@ # Widget to display a man page import re -from Tkinter import * -from Tkinter import _tkinter -from ScrolledText import ScrolledText +from tkinter import * +from tkinter import _tkinter +from tkinter.scrolledtext import ScrolledText # XXX These fonts may have to be changed to match your system BOLDFONT = '*-Courier-Bold-R-Normal-*-120-*' diff --git a/Demo/tkinter/guido/MimeViewer.py b/Demo/tkinter/guido/MimeViewer.py index 7494425..11701cd 100755 --- a/Demo/tkinter/guido/MimeViewer.py +++ b/Demo/tkinter/guido/MimeViewer.py @@ -5,8 +5,8 @@ import string from types import * -from Tkinter import * -from ScrolledText import ScrolledText +from tkinter import * +from tkinter.scrolledtext import ScrolledText class MimeViewer: def __init__(self, parent, title, msg): diff --git a/Demo/tkinter/guido/ShellWindow.py b/Demo/tkinter/guido/ShellWindow.py index c1d56ef..fffcbc5 100755 --- a/Demo/tkinter/guido/ShellWindow.py +++ b/Demo/tkinter/guido/ShellWindow.py @@ -1,9 +1,9 @@ import os import sys import string -from Tkinter import * -from ScrolledText import ScrolledText -from Dialog import Dialog +from tkinter import * +from tkinter.scrolledtext import ScrolledText +from tkinter.dialog import Dialog import signal BUFSIZE = 512 diff --git a/Demo/tkinter/guido/brownian.py b/Demo/tkinter/guido/brownian.py index 8007f14..7ab3e67 100644 --- a/Demo/tkinter/guido/brownian.py +++ b/Demo/tkinter/guido/brownian.py @@ -1,6 +1,6 @@ # Brownian motion -- an example of a multi-threaded Tkinter program. -from Tkinter import * +from tkinter import * import random import threading import time diff --git a/Demo/tkinter/guido/brownian2.py b/Demo/tkinter/guido/brownian2.py index 281a645..dc1d43a 100644 --- a/Demo/tkinter/guido/brownian2.py +++ b/Demo/tkinter/guido/brownian2.py @@ -1,7 +1,7 @@ # Brownian motion -- an example of a NON multi-threaded Tkinter program ;) # By Michele Simoniato, inspired by brownian.py -from Tkinter import * +from tkinter import * import random import sys diff --git a/Demo/tkinter/guido/canvasevents.py b/Demo/tkinter/guido/canvasevents.py index 74ed76f..aeb0eb1 100644 --- a/Demo/tkinter/guido/canvasevents.py +++ b/Demo/tkinter/guido/canvasevents.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -from Tkinter import * +from tkinter import * from Canvas import Oval, Group, CanvasText diff --git a/Demo/tkinter/guido/dialog.py b/Demo/tkinter/guido/dialog.py index 426eca4..1832ba4 100755 --- a/Demo/tkinter/guido/dialog.py +++ b/Demo/tkinter/guido/dialog.py @@ -4,7 +4,7 @@ # optional bitmap, and any number of buttons. # Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.2-3, pp. 269-270. -from Tkinter import * +from tkinter import * import sys diff --git a/Demo/tkinter/guido/electrons.py b/Demo/tkinter/guido/electrons.py index fdc558f..e3bf468 100755 --- a/Demo/tkinter/guido/electrons.py +++ b/Demo/tkinter/guido/electrons.py @@ -11,7 +11,7 @@ # /usr/include/X11/bitmaps for samples); it is displayed as the # background of the animation. Default is no bitmap. -from Tkinter import * +from tkinter import * import random diff --git a/Demo/tkinter/guido/hanoi.py b/Demo/tkinter/guido/hanoi.py index 58ba1d1..a29b1d7 100755 --- a/Demo/tkinter/guido/hanoi.py +++ b/Demo/tkinter/guido/hanoi.py @@ -10,7 +10,7 @@ # background of the animation. Default is no bitmap. # This uses Steen Lumholt's Tk interface -from Tkinter import * +from tkinter import * # Basic Towers-of-Hanoi algorithm: move n pieces from a to b, using c diff --git a/Demo/tkinter/guido/hello.py b/Demo/tkinter/guido/hello.py index 358a7ec..f10fb7a 100755 --- a/Demo/tkinter/guido/hello.py +++ b/Demo/tkinter/guido/hello.py @@ -1,7 +1,7 @@ # Display hello, world in a button; clicking it quits the program import sys -from Tkinter import * +from tkinter import * def main(): root = Tk() diff --git a/Demo/tkinter/guido/imagedraw.py b/Demo/tkinter/guido/imagedraw.py index d3dba45..a168831 100755 --- a/Demo/tkinter/guido/imagedraw.py +++ b/Demo/tkinter/guido/imagedraw.py @@ -1,6 +1,6 @@ """Draw on top of an image""" -from Tkinter import * +from tkinter import * import sys def main(): diff --git a/Demo/tkinter/guido/imageview.py b/Demo/tkinter/guido/imageview.py index d6efed0..276858a 100755 --- a/Demo/tkinter/guido/imageview.py +++ b/Demo/tkinter/guido/imageview.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import sys def main(): diff --git a/Demo/tkinter/guido/kill.py b/Demo/tkinter/guido/kill.py index 36b479d..36caba6 100755 --- a/Demo/tkinter/guido/kill.py +++ b/Demo/tkinter/guido/kill.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # Tkinter interface to Linux `kill' command. -from Tkinter import * +from tkinter import * from string import splitfields from string import split import subprocess diff --git a/Demo/tkinter/guido/listtree.py b/Demo/tkinter/guido/listtree.py index d28ce49..625d20e 100755 --- a/Demo/tkinter/guido/listtree.py +++ b/Demo/tkinter/guido/listtree.py @@ -3,7 +3,7 @@ import sys import string -from Tkinter import * +from tkinter import * def listtree(master, app): list = Listbox(master, name='list') diff --git a/Demo/tkinter/guido/mbox.py b/Demo/tkinter/guido/mbox.py index 88b0b89..45c384e 100755 --- a/Demo/tkinter/guido/mbox.py +++ b/Demo/tkinter/guido/mbox.py @@ -9,7 +9,7 @@ import getopt import string import mhlib -from Tkinter import * +from tkinter import * from dialog import dialog diff --git a/Demo/tkinter/guido/newmenubardemo.py b/Demo/tkinter/guido/newmenubardemo.py index 57bf13c..51c4e64 100644 --- a/Demo/tkinter/guido/newmenubardemo.py +++ b/Demo/tkinter/guido/newmenubardemo.py @@ -2,7 +2,7 @@ """Play with the new Tk 8.0 toplevel menu option.""" -from Tkinter import * +from tkinter import * class App: diff --git a/Demo/tkinter/guido/optionmenu.py b/Demo/tkinter/guido/optionmenu.py index 7365fa6..1e72aa5 100644 --- a/Demo/tkinter/guido/optionmenu.py +++ b/Demo/tkinter/guido/optionmenu.py @@ -1,6 +1,6 @@ # option menu sample (Fredrik Lundh, September 1997) -from Tkinter import * +from tkinter import * root = Tk() diff --git a/Demo/tkinter/guido/paint.py b/Demo/tkinter/guido/paint.py index 7b2e814..65f2353 100644 --- a/Demo/tkinter/guido/paint.py +++ b/Demo/tkinter/guido/paint.py @@ -20,7 +20,7 @@ options like other shapes or colors... davem@magnet.com """ -from Tkinter import * +from tkinter import * """paint.py: not exactly a paint program.. just a smooth line drawing demo.""" diff --git a/Demo/tkinter/guido/rmt.py b/Demo/tkinter/guido/rmt.py index c177c72..7b3f700 100755 --- a/Demo/tkinter/guido/rmt.py +++ b/Demo/tkinter/guido/rmt.py @@ -11,7 +11,7 @@ # XXX This should be written in a more Python-like style!!! -from Tkinter import * +from tkinter import * import sys # 1. Create basic application structure: menu bar on top of diff --git a/Demo/tkinter/guido/solitaire.py b/Demo/tkinter/guido/solitaire.py index a521c66..b2a2a66 100755 --- a/Demo/tkinter/guido/solitaire.py +++ b/Demo/tkinter/guido/solitaire.py @@ -25,7 +25,7 @@ know! import math import random -from Tkinter import * +from tkinter import * from Canvas import Rectangle, CanvasText, Group, Window diff --git a/Demo/tkinter/guido/sortvisu.py b/Demo/tkinter/guido/sortvisu.py index 27dc9f0..0c71fc9 100644 --- a/Demo/tkinter/guido/sortvisu.py +++ b/Demo/tkinter/guido/sortvisu.py @@ -19,7 +19,7 @@ stand-alone application. """ -from Tkinter import * +from tkinter import * from Canvas import Line, Rectangle import random diff --git a/Demo/tkinter/guido/ss1.py b/Demo/tkinter/guido/ss1.py index d957907..6a7aefc 100644 --- a/Demo/tkinter/guido/ss1.py +++ b/Demo/tkinter/guido/ss1.py @@ -485,7 +485,7 @@ def colnum2name(n): s = chr(m+ord('A')) + s return s -import Tkinter as Tk +import tkinter as Tk class SheetGUI: diff --git a/Demo/tkinter/guido/svkill.py b/Demo/tkinter/guido/svkill.py index b9d82ab..0dd9f95 100755 --- a/Demo/tkinter/guido/svkill.py +++ b/Demo/tkinter/guido/svkill.py @@ -2,7 +2,7 @@ # Tkinter interface to SYSV `ps' and `kill' commands. -from Tkinter import * +from tkinter import * if TkVersion < 4.0: raise ImportError("This version of svkill requires Tk 4.0 or later") diff --git a/Demo/tkinter/guido/switch.py b/Demo/tkinter/guido/switch.py index 3b58f7c..3f43925 100644 --- a/Demo/tkinter/guido/switch.py +++ b/Demo/tkinter/guido/switch.py @@ -1,6 +1,6 @@ # Show how to do switchable panels. -from Tkinter import * +from tkinter import * class App: diff --git a/Demo/tkinter/guido/tkman.py b/Demo/tkinter/guido/tkman.py index c84d889..52b6d03 100755 --- a/Demo/tkinter/guido/tkman.py +++ b/Demo/tkinter/guido/tkman.py @@ -6,7 +6,7 @@ import sys import os import string import re -from Tkinter import * +from tkinter import * from ManPage import ManPage MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann'] diff --git a/Demo/tkinter/matt/00-HELLO-WORLD.py b/Demo/tkinter/matt/00-HELLO-WORLD.py index 20a2050..3b4092a 100644 --- a/Demo/tkinter/matt/00-HELLO-WORLD.py +++ b/Demo/tkinter/matt/00-HELLO-WORLD.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # note that there is no explicit call to start Tk. # Tkinter is smart enough to start the system if it's not already going. diff --git a/Demo/tkinter/matt/animation-simple.py b/Demo/tkinter/matt/animation-simple.py index 071bde7..4120d66 100644 --- a/Demo/tkinter/matt/animation-simple.py +++ b/Demo/tkinter/matt/animation-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This program shows how to use the "after" function to make animation. diff --git a/Demo/tkinter/matt/animation-w-velocity-ctrl.py b/Demo/tkinter/matt/animation-w-velocity-ctrl.py index 68eb1d0..88309ca 100644 --- a/Demo/tkinter/matt/animation-w-velocity-ctrl.py +++ b/Demo/tkinter/matt/animation-w-velocity-ctrl.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this is the same as simple-demo-1.py, but uses # subclassing. diff --git a/Demo/tkinter/matt/bind-w-mult-calls-p-type.py b/Demo/tkinter/matt/bind-w-mult-calls-p-type.py index f744d26..af0ec81 100644 --- a/Demo/tkinter/matt/bind-w-mult-calls-p-type.py +++ b/Demo/tkinter/matt/bind-w-mult-calls-p-type.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import string # This program shows how to use a simple type-in box diff --git a/Demo/tkinter/matt/canvas-demo-simple.py b/Demo/tkinter/matt/canvas-demo-simple.py index b677ccd..7f2c17b 100644 --- a/Demo/tkinter/matt/canvas-demo-simple.py +++ b/Demo/tkinter/matt/canvas-demo-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this program creates a canvas and puts a single polygon on the canvas diff --git a/Demo/tkinter/matt/canvas-gridding.py b/Demo/tkinter/matt/canvas-gridding.py index 84f4ea0..2f9d23a 100644 --- a/Demo/tkinter/matt/canvas-gridding.py +++ b/Demo/tkinter/matt/canvas-gridding.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this is the same as simple-demo-1.py, but uses # subclassing. diff --git a/Demo/tkinter/matt/canvas-moving-or-creating.py b/Demo/tkinter/matt/canvas-moving-or-creating.py index 5327c08..edd64f7 100644 --- a/Demo/tkinter/matt/canvas-moving-or-creating.py +++ b/Demo/tkinter/matt/canvas-moving-or-creating.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this file demonstrates a more sophisticated movement -- # move dots or create new ones if you click outside the dots diff --git a/Demo/tkinter/matt/canvas-moving-w-mouse.py b/Demo/tkinter/matt/canvas-moving-w-mouse.py index 81785d8..21d724f 100644 --- a/Demo/tkinter/matt/canvas-moving-w-mouse.py +++ b/Demo/tkinter/matt/canvas-moving-w-mouse.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this file demonstrates the movement of a single canvas item under mouse control diff --git a/Demo/tkinter/matt/canvas-mult-item-sel.py b/Demo/tkinter/matt/canvas-mult-item-sel.py index a4f267c..4875b44 100644 --- a/Demo/tkinter/matt/canvas-mult-item-sel.py +++ b/Demo/tkinter/matt/canvas-mult-item-sel.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # allows moving dots with multiple selection. diff --git a/Demo/tkinter/matt/canvas-reading-tag-info.py b/Demo/tkinter/matt/canvas-reading-tag-info.py index 75990c9..265f0a1 100644 --- a/Demo/tkinter/matt/canvas-reading-tag-info.py +++ b/Demo/tkinter/matt/canvas-reading-tag-info.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class Test(Frame): diff --git a/Demo/tkinter/matt/canvas-w-widget-draw-el.py b/Demo/tkinter/matt/canvas-w-widget-draw-el.py index 3cbf937..ca96583 100644 --- a/Demo/tkinter/matt/canvas-w-widget-draw-el.py +++ b/Demo/tkinter/matt/canvas-w-widget-draw-el.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this file demonstrates the creation of widgets as part of a canvas object diff --git a/Demo/tkinter/matt/canvas-with-scrollbars.py b/Demo/tkinter/matt/canvas-with-scrollbars.py index b55215d..1c5681a 100644 --- a/Demo/tkinter/matt/canvas-with-scrollbars.py +++ b/Demo/tkinter/matt/canvas-with-scrollbars.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This example program creates a scroling canvas, and demonstrates # how to tie scrollbars and canvses together. The mechanism diff --git a/Demo/tkinter/matt/dialog-box.py b/Demo/tkinter/matt/dialog-box.py index 0c71c3a..c0b8825 100644 --- a/Demo/tkinter/matt/dialog-box.py +++ b/Demo/tkinter/matt/dialog-box.py @@ -1,5 +1,5 @@ -from Tkinter import * -from Dialog import Dialog +from tkinter import * +from tkinter.dialog import Dialog # this shows how to create a new window with a button in it # that can create new windows diff --git a/Demo/tkinter/matt/entry-simple.py b/Demo/tkinter/matt/entry-simple.py index 0bf4cab..1f55df5 100644 --- a/Demo/tkinter/matt/entry-simple.py +++ b/Demo/tkinter/matt/entry-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import string # This program shows how to use a simple type-in box diff --git a/Demo/tkinter/matt/entry-with-shared-variable.py b/Demo/tkinter/matt/entry-with-shared-variable.py index c7cd259..473a596 100644 --- a/Demo/tkinter/matt/entry-with-shared-variable.py +++ b/Demo/tkinter/matt/entry-with-shared-variable.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import string # This program shows how to make a typein box shadow a program variable. diff --git a/Demo/tkinter/matt/killing-window-w-wm.py b/Demo/tkinter/matt/killing-window-w-wm.py index 23ac103..b4034d1 100644 --- a/Demo/tkinter/matt/killing-window-w-wm.py +++ b/Demo/tkinter/matt/killing-window-w-wm.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This file shows how to trap the killing of a window # when the user uses window manager menus (typ. upper left hand corner diff --git a/Demo/tkinter/matt/menu-all-types-of-entries.py b/Demo/tkinter/matt/menu-all-types-of-entries.py index e4e4bfd..1e3bb8c 100644 --- a/Demo/tkinter/matt/menu-all-types-of-entries.py +++ b/Demo/tkinter/matt/menu-all-types-of-entries.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # some vocabulary to keep from getting confused. This terminology # is something I cooked up for this file, but follows the man pages diff --git a/Demo/tkinter/matt/menu-simple.py b/Demo/tkinter/matt/menu-simple.py index 2487561..a927c50 100644 --- a/Demo/tkinter/matt/menu-simple.py +++ b/Demo/tkinter/matt/menu-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # some vocabulary to keep from getting confused. This terminology # is something I cooked up for this file, but follows the man pages diff --git a/Demo/tkinter/matt/not-what-you-might-think-1.py b/Demo/tkinter/matt/not-what-you-might-think-1.py index 7b20f02..85c65c8 100644 --- a/Demo/tkinter/matt/not-what-you-might-think-1.py +++ b/Demo/tkinter/matt/not-what-you-might-think-1.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class Test(Frame): diff --git a/Demo/tkinter/matt/not-what-you-might-think-2.py b/Demo/tkinter/matt/not-what-you-might-think-2.py index 9ee197c..4512063 100644 --- a/Demo/tkinter/matt/not-what-you-might-think-2.py +++ b/Demo/tkinter/matt/not-what-you-might-think-2.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class Test(Frame): diff --git a/Demo/tkinter/matt/packer-and-placer-together.py b/Demo/tkinter/matt/packer-and-placer-together.py index 84d3ee0..3cf6c45 100644 --- a/Demo/tkinter/matt/packer-and-placer-together.py +++ b/Demo/tkinter/matt/packer-and-placer-together.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This is a program that tests the placer geom manager in conjunction with # the packer. The background (green) is packed, while the widget inside is placed diff --git a/Demo/tkinter/matt/packer-simple.py b/Demo/tkinter/matt/packer-simple.py index 1a505dd..64f61d5 100644 --- a/Demo/tkinter/matt/packer-simple.py +++ b/Demo/tkinter/matt/packer-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class Test(Frame): diff --git a/Demo/tkinter/matt/placer-simple.py b/Demo/tkinter/matt/placer-simple.py index 992a8fc..6be0de9 100644 --- a/Demo/tkinter/matt/placer-simple.py +++ b/Demo/tkinter/matt/placer-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This is a program that tests the placer geom manager diff --git a/Demo/tkinter/matt/pong-demo-1.py b/Demo/tkinter/matt/pong-demo-1.py index 7fcf800..09f9f2e 100644 --- a/Demo/tkinter/matt/pong-demo-1.py +++ b/Demo/tkinter/matt/pong-demo-1.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import string diff --git a/Demo/tkinter/matt/printing-coords-of-items.py b/Demo/tkinter/matt/printing-coords-of-items.py index c74c1c3..26a4649 100644 --- a/Demo/tkinter/matt/printing-coords-of-items.py +++ b/Demo/tkinter/matt/printing-coords-of-items.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this file demonstrates the creation of widgets as part of a canvas object diff --git a/Demo/tkinter/matt/radiobutton-simple.py b/Demo/tkinter/matt/radiobutton-simple.py index eeddb23..a2719b8 100644 --- a/Demo/tkinter/matt/radiobutton-simple.py +++ b/Demo/tkinter/matt/radiobutton-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This is a demo program that shows how to # create radio buttons and how to get other widgets to diff --git a/Demo/tkinter/matt/rubber-band-box-demo-1.py b/Demo/tkinter/matt/rubber-band-box-demo-1.py index 66b8f8b..48526d8 100644 --- a/Demo/tkinter/matt/rubber-band-box-demo-1.py +++ b/Demo/tkinter/matt/rubber-band-box-demo-1.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class Test(Frame): def printit(self): diff --git a/Demo/tkinter/matt/rubber-line-demo-1.py b/Demo/tkinter/matt/rubber-line-demo-1.py index b1c8e78..cfc4882 100644 --- a/Demo/tkinter/matt/rubber-line-demo-1.py +++ b/Demo/tkinter/matt/rubber-line-demo-1.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * class Test(Frame): def printit(self): diff --git a/Demo/tkinter/matt/slider-demo-1.py b/Demo/tkinter/matt/slider-demo-1.py index 5662db9..687f8a3 100644 --- a/Demo/tkinter/matt/slider-demo-1.py +++ b/Demo/tkinter/matt/slider-demo-1.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # shows how to make a slider, set and get its value under program control diff --git a/Demo/tkinter/matt/subclass-existing-widgets.py b/Demo/tkinter/matt/subclass-existing-widgets.py index fc04859..ce97f35 100644 --- a/Demo/tkinter/matt/subclass-existing-widgets.py +++ b/Demo/tkinter/matt/subclass-existing-widgets.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # This is a program that makes a simple two button application diff --git a/Demo/tkinter/matt/two-radio-groups.py b/Demo/tkinter/matt/two-radio-groups.py index 52513ba..38b61b1 100644 --- a/Demo/tkinter/matt/two-radio-groups.py +++ b/Demo/tkinter/matt/two-radio-groups.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # The way to think about this is that each radio button menu # controls a different variable -- clicking on one of the diff --git a/Demo/tkinter/matt/window-creation-more.py b/Demo/tkinter/matt/window-creation-more.py index 3a4ce19..32c8b70 100644 --- a/Demo/tkinter/matt/window-creation-more.py +++ b/Demo/tkinter/matt/window-creation-more.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this shows how to create a new window with a button in it # that can create new windows diff --git a/Demo/tkinter/matt/window-creation-simple.py b/Demo/tkinter/matt/window-creation-simple.py index fdf1dcc..f5e6230 100644 --- a/Demo/tkinter/matt/window-creation-simple.py +++ b/Demo/tkinter/matt/window-creation-simple.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * # this shows how to spawn off new windows at a button press diff --git a/Demo/tkinter/matt/window-creation-w-location.py b/Demo/tkinter/matt/window-creation-w-location.py index af6f876..9f82367 100644 --- a/Demo/tkinter/matt/window-creation-w-location.py +++ b/Demo/tkinter/matt/window-creation-w-location.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * import sys ##sys.path.append("/users/mjc4y/projects/python/tkinter/utils") |