Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6d63f5

Browse files
committed
fix a lot of Tkinter imports
1 parent 6cb2bdd commit d6d63f5

76 files changed

Lines changed: 542 additions & 542 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Demo/tix/grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###
2-
import Tix as tk
2+
import tkinter.tix as tk
33
from pprint import pprint
44

55
r= tk.Tk()

Demo/tix/samples/Balloon.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Your can display the help message in a "balloon" and a status bar widget.
1616
#
1717

18-
import Tix
18+
import tkinter.tix
1919

2020
TCL_ALL_EVENTS = 0
2121

@@ -32,20 +32,20 @@ def __init__(self, w):
3232
z = w.winfo_toplevel()
3333
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
3434

35-
status = Tix.Label(w, width=40, relief=Tix.SUNKEN, bd=1)
36-
status.pack(side=Tix.BOTTOM, fill=Tix.Y, padx=2, pady=1)
35+
status = tkinter.tix.Label(w, width=40, relief=tkinter.tix.SUNKEN, bd=1)
36+
status.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.Y, padx=2, pady=1)
3737

3838
# Create two mysterious widgets that need balloon help
39-
button1 = Tix.Button(w, text='Something Unexpected',
39+
button1 = tkinter.tix.Button(w, text='Something Unexpected',
4040
command=self.quitcmd)
41-
button2 = Tix.Button(w, text='Something Else Unexpected')
41+
button2 = tkinter.tix.Button(w, text='Something Else Unexpected')
4242
button2['command'] = lambda w=button2: w.destroy()
43-
button1.pack(side=Tix.TOP, expand=1)
44-
button2.pack(side=Tix.TOP, expand=1)
43+
button1.pack(side=tkinter.tix.TOP, expand=1)
44+
button2.pack(side=tkinter.tix.TOP, expand=1)
4545

4646
# Create the balloon widget and associate it with the widgets that we want
4747
# to provide tips for:
48-
b = Tix.Balloon(w, statusbar=status)
48+
b = tkinter.tix.Balloon(w, statusbar=status)
4949

5050
b.bind_widget(button1, balloonmsg='Close Window',
5151
statusmsg='Press this button to close this window')
@@ -64,5 +64,5 @@ def destroy (self):
6464
self.root.destroy()
6565

6666
if __name__ == '__main__':
67-
root = Tix.Tk()
67+
root = tkinter.tix.Tk()
6868
RunSample(root)

Demo/tix/samples/BtnBox.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
# for example.
1616
#
1717

18-
import Tix
18+
import tkinter.tix
1919

2020
def RunSample(w):
2121
# Create the label on the top of the dialog box
2222
#
23-
top = Tix.Label(w, padx=20, pady=10, bd=1, relief=Tix.RAISED,
24-
anchor=Tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget')
23+
top = tkinter.tix.Label(w, padx=20, pady=10, bd=1, relief=tkinter.tix.RAISED,
24+
anchor=tkinter.tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget')
2525

2626
# Create the button box and add a few buttons in it. Set the
2727
# -width of all the buttons to the same value so that they
@@ -30,15 +30,15 @@ def RunSample(w):
3030
# Note that the -text, -underline, -command and -width options are all
3131
# standard options of the button widgets.
3232
#
33-
box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
33+
box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
3434
box.add('ok', text='OK', underline=0, width=5,
3535
command=lambda w=w: w.destroy())
3636
box.add('close', text='Cancel', underline=0, width=5,
3737
command=lambda w=w: w.destroy())
38-
box.pack(side=Tix.BOTTOM, fill=Tix.X)
39-
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
38+
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
39+
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
4040

4141
if __name__ == '__main__':
42-
root = Tix.Tk()
42+
root = tkinter.tix.Tk()
4343
RunSample(root)
4444
root.mainloop()

Demo/tix/samples/CmpImg.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# buttons
1616
#
1717

18-
import Tix
18+
import tkinter.tix
1919

2020
network_pixmap = """/* XPM */
2121
static char * netw_xpm[] = {
@@ -144,23 +144,23 @@
144144
"""
145145

146146
def RunSample(w):
147-
w.img0 = Tix.Image('pixmap', data=network_pixmap)
147+
w.img0 = tkinter.tix.Image('pixmap', data=network_pixmap)
148148
if not w.img0:
149-
w.img0 = Tix.Image('bitmap', data=network_bitmap)
150-
w.img1 = Tix.Image('pixmap', data=hard_disk_pixmap)
149+
w.img0 = tkinter.tix.Image('bitmap', data=network_bitmap)
150+
w.img1 = tkinter.tix.Image('pixmap', data=hard_disk_pixmap)
151151
if not w.img0:
152-
w.img1 = Tix.Image('bitmap', data=hard_disk_bitmap)
152+
w.img1 = tkinter.tix.Image('bitmap', data=hard_disk_bitmap)
153153

154-
hdd = Tix.Button(w, padx=4, pady=1, width=120)
155-
net = Tix.Button(w, padx=4, pady=1, width=120)
154+
hdd = tkinter.tix.Button(w, padx=4, pady=1, width=120)
155+
net = tkinter.tix.Button(w, padx=4, pady=1, width=120)
156156

157157
# Create the first image: we create a line, then put a string,
158158
# a space and a image into this line, from left to right.
159159
# The result: we have a one-line image that consists of three
160160
# individual items
161161
#
162162
# The tk.calls should be methods in Tix ...
163-
w.hdd_img = Tix.Image('compound', window=hdd)
163+
w.hdd_img = tkinter.tix.Image('compound', window=hdd)
164164
w.hdd_img.tk.call(str(w.hdd_img), 'add', 'line')
165165
w.hdd_img.tk.call(str(w.hdd_img), 'add', 'text', '-text', 'Hard Disk',
166166
'-underline', '0')
@@ -172,7 +172,7 @@ def RunSample(w):
172172
hdd['image'] = w.hdd_img
173173

174174
# Next button
175-
w.net_img = Tix.Image('compound', window=net)
175+
w.net_img = tkinter.tix.Image('compound', window=net)
176176
w.net_img.tk.call(str(w.net_img), 'add', 'line')
177177
w.net_img.tk.call(str(w.net_img), 'add', 'text', '-text', 'Network',
178178
'-underline', '0')
@@ -183,14 +183,14 @@ def RunSample(w):
183183
#
184184
net['image'] = w.net_img
185185

186-
close = Tix.Button(w, pady=1, text='Close',
186+
close = tkinter.tix.Button(w, pady=1, text='Close',
187187
command=lambda w=w: w.destroy())
188188

189-
hdd.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1)
190-
net.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1)
191-
close.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1)
189+
hdd.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
190+
net.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
191+
close.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
192192

193193
if __name__ == '__main__':
194-
root = Tix.Tk()
194+
root = tkinter.tix.Tk()
195195
RunSample(root)
196196
root.mainloop()

Demo/tix/samples/ComboBox.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
# This file demonstrates the use of the tixComboBox widget, which is close
1414
# to the MS Window Combo Box control.
1515
#
16-
import Tix
16+
import tkinter.tix
1717

1818
def RunSample(w):
1919
global demo_month, demo_year
2020

21-
top = Tix.Frame(w, bd=1, relief=Tix.RAISED)
21+
top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED)
2222

23-
demo_month = Tix.StringVar()
24-
demo_year = Tix.StringVar()
23+
demo_month = tkinter.tix.StringVar()
24+
demo_year = tkinter.tix.StringVar()
2525

2626
# $w.top.a is a drop-down combo box. It is not editable -- who wants
2727
# to invent new months?
@@ -30,7 +30,7 @@ def RunSample(w):
3030
# [Hint] We set the label.width subwidget option of both comboboxes to
3131
# be 10 so that their labels appear to be aligned.
3232
#
33-
a = Tix.ComboBox(top, label="Month: ", dropdown=1,
33+
a = tkinter.tix.ComboBox(top, label="Month: ", dropdown=1,
3434
command=select_month, editable=0, variable=demo_month,
3535
options='listbox.height 6 label.width 10 label.anchor e')
3636

@@ -43,31 +43,31 @@ def RunSample(w):
4343
# [Hint] Notice that you should use padY (the NAME of the option) and not
4444
# pady (the SWITCH of the option).
4545
#
46-
b = Tix.ComboBox(top, label="Year: ", dropdown=0,
46+
b = tkinter.tix.ComboBox(top, label="Year: ", dropdown=0,
4747
command=select_year, editable=1, variable=demo_year,
4848
options='listbox.height 4 label.padY 5 label.width 10 label.anchor ne')
4949

50-
a.pack(side=Tix.TOP, anchor=Tix.W)
51-
b.pack(side=Tix.TOP, anchor=Tix.W)
50+
a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
51+
b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
5252

53-
a.insert(Tix.END, 'January')
54-
a.insert(Tix.END, 'February')
55-
a.insert(Tix.END, 'March')
56-
a.insert(Tix.END, 'April')
57-
a.insert(Tix.END, 'May')
58-
a.insert(Tix.END, 'June')
59-
a.insert(Tix.END, 'July')
60-
a.insert(Tix.END, 'August')
61-
a.insert(Tix.END, 'September')
62-
a.insert(Tix.END, 'October')
63-
a.insert(Tix.END, 'November')
64-
a.insert(Tix.END, 'December')
53+
a.insert(tkinter.tix.END, 'January')
54+
a.insert(tkinter.tix.END, 'February')
55+
a.insert(tkinter.tix.END, 'March')
56+
a.insert(tkinter.tix.END, 'April')
57+
a.insert(tkinter.tix.END, 'May')
58+
a.insert(tkinter.tix.END, 'June')
59+
a.insert(tkinter.tix.END, 'July')
60+
a.insert(tkinter.tix.END, 'August')
61+
a.insert(tkinter.tix.END, 'September')
62+
a.insert(tkinter.tix.END, 'October')
63+
a.insert(tkinter.tix.END, 'November')
64+
a.insert(tkinter.tix.END, 'December')
6565

66-
b.insert(Tix.END, '1992')
67-
b.insert(Tix.END, '1993')
68-
b.insert(Tix.END, '1994')
69-
b.insert(Tix.END, '1995')
70-
b.insert(Tix.END, '1996')
66+
b.insert(tkinter.tix.END, '1992')
67+
b.insert(tkinter.tix.END, '1993')
68+
b.insert(tkinter.tix.END, '1994')
69+
b.insert(tkinter.tix.END, '1995')
70+
b.insert(tkinter.tix.END, '1996')
7171

7272
# Use "tixSetSilent" to set the values of the combo box if you
7373
# don't want your -command procedures (cbx:select_month and
@@ -76,13 +76,13 @@ def RunSample(w):
7676
a.set_silent('January')
7777
b.set_silent('1995')
7878

79-
box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
79+
box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
8080
box.add('ok', text='Ok', underline=0, width=6,
8181
command=lambda w=w: ok_command(w))
8282
box.add('cancel', text='Cancel', underline=0, width=6,
8383
command=lambda w=w: w.destroy())
84-
box.pack(side=Tix.BOTTOM, fill=Tix.X)
85-
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
84+
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
85+
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
8686

8787
def select_month(event=None):
8888
# tixDemo:Status "Month = %s" % demo_month.get()
@@ -97,6 +97,6 @@ def ok_command(w):
9797
w.destroy()
9898

9999
if __name__ == '__main__':
100-
root = Tix.Tk()
100+
root = tkinter.tix.Tk()
101101
RunSample(root)
102102
root.mainloop()

Demo/tix/samples/Control.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# integer values; one lets you select floating point values and the last
1919
# one lets you select a few names.
2020

21-
import Tix
21+
import tkinter.tix
2222

2323
TCL_ALL_EVENTS = 0
2424

@@ -34,31 +34,31 @@ def __init__(self, w):
3434

3535
global demo_maker, demo_thrust, demo_num_engines
3636

37-
demo_maker = Tix.StringVar()
38-
demo_thrust = Tix.DoubleVar()
39-
demo_num_engines = Tix.IntVar()
37+
demo_maker = tkinter.tix.StringVar()
38+
demo_thrust = tkinter.tix.DoubleVar()
39+
demo_num_engines = tkinter.tix.IntVar()
4040
demo_maker.set('P&W')
4141
demo_thrust.set(20000.0)
4242
demo_num_engines.set(2)
4343

44-
top = Tix.Frame(w, bd=1, relief=Tix.RAISED)
44+
top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED)
4545

4646
# $w.top.a allows only integer values
4747
#
4848
# [Hint] The -options switch sets the options of the subwidgets.
4949
# [Hint] We set the label.width subwidget option of the Controls to
5050
# be 16 so that their labels appear to be aligned.
5151
#
52-
a = Tix.Control(top, label='Number of Engines: ', integer=1,
52+
a = tkinter.tix.Control(top, label='Number of Engines: ', integer=1,
5353
variable=demo_num_engines, min=1, max=4,
5454
options='entry.width 10 label.width 20 label.anchor e')
5555

56-
b = Tix.Control(top, label='Thrust: ', integer=0,
56+
b = tkinter.tix.Control(top, label='Thrust: ', integer=0,
5757
min='10000.0', max='60000.0', step=500,
5858
variable=demo_thrust,
5959
options='entry.width 10 label.width 20 label.anchor e')
6060

61-
c = Tix.Control(top, label='Engine Maker: ', value='P&W',
61+
c = tkinter.tix.Control(top, label='Engine Maker: ', value='P&W',
6262
variable=demo_maker,
6363
options='entry.width 10 label.width 20 label.anchor e')
6464

@@ -68,17 +68,17 @@ def __init__(self, w):
6868
c['decrcmd'] = lambda w=c: adjust_maker(w, -1)
6969
c['validatecmd'] = lambda w=c: validate_maker(w)
7070

71-
a.pack(side=Tix.TOP, anchor=Tix.W)
72-
b.pack(side=Tix.TOP, anchor=Tix.W)
73-
c.pack(side=Tix.TOP, anchor=Tix.W)
71+
a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
72+
b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
73+
c.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
7474

75-
box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
75+
box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL)
7676
box.add('ok', text='Ok', underline=0, width=6,
7777
command=self.okcmd)
7878
box.add('cancel', text='Cancel', underline=0, width=6,
7979
command=self.quitcmd)
80-
box.pack(side=Tix.BOTTOM, fill=Tix.X)
81-
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
80+
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
81+
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
8282

8383
def okcmd (self):
8484
# 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):
118118
return maker_list[i]
119119

120120
if __name__ == '__main__':
121-
root = Tix.Tk()
121+
root = tkinter.tix.Tk()
122122
RunSample(root)

0 commit comments

Comments
 (0)