mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
fix a lot of Tkinter imports
This commit is contained in:
parent
6cb2bddb85
commit
d6d63f5437
76 changed files with 536 additions and 536 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue