mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +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
|
@ -1,5 +1,5 @@
|
||||||
###
|
###
|
||||||
import Tix as tk
|
import tkinter.tix as tk
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
r= tk.Tk()
|
r= tk.Tk()
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# Your can display the help message in a "balloon" and a status bar widget.
|
# Your can display the help message in a "balloon" and a status bar widget.
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -32,20 +32,20 @@ class DemoBalloon:
|
||||||
z = w.winfo_toplevel()
|
z = w.winfo_toplevel()
|
||||||
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
|
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
|
||||||
|
|
||||||
status = Tix.Label(w, width=40, relief=Tix.SUNKEN, bd=1)
|
status = tkinter.tix.Label(w, width=40, relief=tkinter.tix.SUNKEN, bd=1)
|
||||||
status.pack(side=Tix.BOTTOM, fill=Tix.Y, padx=2, pady=1)
|
status.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.Y, padx=2, pady=1)
|
||||||
|
|
||||||
# Create two mysterious widgets that need balloon help
|
# 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)
|
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()
|
button2['command'] = lambda w=button2: w.destroy()
|
||||||
button1.pack(side=Tix.TOP, expand=1)
|
button1.pack(side=tkinter.tix.TOP, expand=1)
|
||||||
button2.pack(side=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
|
# Create the balloon widget and associate it with the widgets that we want
|
||||||
# to provide tips for:
|
# to provide tips for:
|
||||||
b = Tix.Balloon(w, statusbar=status)
|
b = tkinter.tix.Balloon(w, statusbar=status)
|
||||||
|
|
||||||
b.bind_widget(button1, balloonmsg='Close Window',
|
b.bind_widget(button1, balloonmsg='Close Window',
|
||||||
statusmsg='Press this button to close this window')
|
statusmsg='Press this button to close this window')
|
||||||
|
@ -64,5 +64,5 @@ class DemoBalloon:
|
||||||
self.root.destroy()
|
self.root.destroy()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
# for example.
|
# for example.
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
# Create the label on the top of the dialog box
|
# Create the label on the top of the dialog box
|
||||||
#
|
#
|
||||||
top = Tix.Label(w, padx=20, pady=10, bd=1, relief=Tix.RAISED,
|
top = tkinter.tix.Label(w, padx=20, pady=10, bd=1, relief=tkinter.tix.RAISED,
|
||||||
anchor=Tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget')
|
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
|
# 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
|
# -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
|
# Note that the -text, -underline, -command and -width options are all
|
||||||
# standard options of the button widgets.
|
# 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,
|
box.add('ok', text='OK', underline=0, width=5,
|
||||||
command=lambda w=w: w.destroy())
|
command=lambda w=w: w.destroy())
|
||||||
box.add('close', text='Cancel', underline=0, width=5,
|
box.add('close', text='Cancel', underline=0, width=5,
|
||||||
command=lambda w=w: w.destroy())
|
command=lambda w=w: w.destroy())
|
||||||
box.pack(side=Tix.BOTTOM, fill=Tix.X)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
|
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# buttons
|
# buttons
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
network_pixmap = """/* XPM */
|
network_pixmap = """/* XPM */
|
||||||
static char * netw_xpm[] = {
|
static char * netw_xpm[] = {
|
||||||
|
@ -144,15 +144,15 @@ static unsigned char drivea_bits[] = {
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
w.img0 = Tix.Image('pixmap', data=network_pixmap)
|
w.img0 = tkinter.tix.Image('pixmap', data=network_pixmap)
|
||||||
if not w.img0:
|
if not w.img0:
|
||||||
w.img0 = Tix.Image('bitmap', data=network_bitmap)
|
w.img0 = tkinter.tix.Image('bitmap', data=network_bitmap)
|
||||||
w.img1 = Tix.Image('pixmap', data=hard_disk_pixmap)
|
w.img1 = tkinter.tix.Image('pixmap', data=hard_disk_pixmap)
|
||||||
if not w.img0:
|
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)
|
hdd = tkinter.tix.Button(w, padx=4, pady=1, width=120)
|
||||||
net = 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,
|
# Create the first image: we create a line, then put a string,
|
||||||
# a space and a image into this line, from left to right.
|
# a space and a image into this line, from left to right.
|
||||||
|
@ -160,7 +160,7 @@ def RunSample(w):
|
||||||
# individual items
|
# individual items
|
||||||
#
|
#
|
||||||
# The tk.calls should be methods in Tix ...
|
# 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', 'line')
|
||||||
w.hdd_img.tk.call(str(w.hdd_img), 'add', 'text', '-text', 'Hard Disk',
|
w.hdd_img.tk.call(str(w.hdd_img), 'add', 'text', '-text', 'Hard Disk',
|
||||||
'-underline', '0')
|
'-underline', '0')
|
||||||
|
@ -172,7 +172,7 @@ def RunSample(w):
|
||||||
hdd['image'] = w.hdd_img
|
hdd['image'] = w.hdd_img
|
||||||
|
|
||||||
# Next button
|
# 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', 'line')
|
||||||
w.net_img.tk.call(str(w.net_img), 'add', 'text', '-text', 'Network',
|
w.net_img.tk.call(str(w.net_img), 'add', 'text', '-text', 'Network',
|
||||||
'-underline', '0')
|
'-underline', '0')
|
||||||
|
@ -183,14 +183,14 @@ def RunSample(w):
|
||||||
#
|
#
|
||||||
net['image'] = w.net_img
|
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())
|
command=lambda w=w: w.destroy())
|
||||||
|
|
||||||
hdd.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=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1)
|
net.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
|
||||||
close.pack(side=Tix.LEFT, padx=10, pady=10, fill=Tix.Y, expand=1)
|
close.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
# This file demonstrates the use of the tixComboBox widget, which is close
|
# This file demonstrates the use of the tixComboBox widget, which is close
|
||||||
# to the MS Window Combo Box control.
|
# to the MS Window Combo Box control.
|
||||||
#
|
#
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
global demo_month, demo_year
|
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_month = tkinter.tix.StringVar()
|
||||||
demo_year = Tix.StringVar()
|
demo_year = tkinter.tix.StringVar()
|
||||||
|
|
||||||
# $w.top.a is a drop-down combo box. It is not editable -- who wants
|
# $w.top.a is a drop-down combo box. It is not editable -- who wants
|
||||||
# to invent new months?
|
# to invent new months?
|
||||||
|
@ -30,7 +30,7 @@ def RunSample(w):
|
||||||
# [Hint] We set the label.width subwidget option of both comboboxes to
|
# [Hint] We set the label.width subwidget option of both comboboxes to
|
||||||
# be 10 so that their labels appear to be aligned.
|
# 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,
|
command=select_month, editable=0, variable=demo_month,
|
||||||
options='listbox.height 6 label.width 10 label.anchor e')
|
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
|
# [Hint] Notice that you should use padY (the NAME of the option) and not
|
||||||
# pady (the SWITCH of the option).
|
# 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,
|
command=select_year, editable=1, variable=demo_year,
|
||||||
options='listbox.height 4 label.padY 5 label.width 10 label.anchor ne')
|
options='listbox.height 4 label.padY 5 label.width 10 label.anchor ne')
|
||||||
|
|
||||||
a.pack(side=Tix.TOP, anchor=Tix.W)
|
a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
|
||||||
b.pack(side=Tix.TOP, anchor=Tix.W)
|
b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
|
||||||
|
|
||||||
a.insert(Tix.END, 'January')
|
a.insert(tkinter.tix.END, 'January')
|
||||||
a.insert(Tix.END, 'February')
|
a.insert(tkinter.tix.END, 'February')
|
||||||
a.insert(Tix.END, 'March')
|
a.insert(tkinter.tix.END, 'March')
|
||||||
a.insert(Tix.END, 'April')
|
a.insert(tkinter.tix.END, 'April')
|
||||||
a.insert(Tix.END, 'May')
|
a.insert(tkinter.tix.END, 'May')
|
||||||
a.insert(Tix.END, 'June')
|
a.insert(tkinter.tix.END, 'June')
|
||||||
a.insert(Tix.END, 'July')
|
a.insert(tkinter.tix.END, 'July')
|
||||||
a.insert(Tix.END, 'August')
|
a.insert(tkinter.tix.END, 'August')
|
||||||
a.insert(Tix.END, 'September')
|
a.insert(tkinter.tix.END, 'September')
|
||||||
a.insert(Tix.END, 'October')
|
a.insert(tkinter.tix.END, 'October')
|
||||||
a.insert(Tix.END, 'November')
|
a.insert(tkinter.tix.END, 'November')
|
||||||
a.insert(Tix.END, 'December')
|
a.insert(tkinter.tix.END, 'December')
|
||||||
|
|
||||||
b.insert(Tix.END, '1992')
|
b.insert(tkinter.tix.END, '1992')
|
||||||
b.insert(Tix.END, '1993')
|
b.insert(tkinter.tix.END, '1993')
|
||||||
b.insert(Tix.END, '1994')
|
b.insert(tkinter.tix.END, '1994')
|
||||||
b.insert(Tix.END, '1995')
|
b.insert(tkinter.tix.END, '1995')
|
||||||
b.insert(Tix.END, '1996')
|
b.insert(tkinter.tix.END, '1996')
|
||||||
|
|
||||||
# Use "tixSetSilent" to set the values of the combo box if you
|
# Use "tixSetSilent" to set the values of the combo box if you
|
||||||
# don't want your -command procedures (cbx:select_month and
|
# don't want your -command procedures (cbx:select_month and
|
||||||
|
@ -76,13 +76,13 @@ def RunSample(w):
|
||||||
a.set_silent('January')
|
a.set_silent('January')
|
||||||
b.set_silent('1995')
|
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,
|
box.add('ok', text='Ok', underline=0, width=6,
|
||||||
command=lambda w=w: ok_command(w))
|
command=lambda w=w: ok_command(w))
|
||||||
box.add('cancel', text='Cancel', underline=0, width=6,
|
box.add('cancel', text='Cancel', underline=0, width=6,
|
||||||
command=lambda w=w: w.destroy())
|
command=lambda w=w: w.destroy())
|
||||||
box.pack(side=Tix.BOTTOM, fill=Tix.X)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
|
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
def select_month(event=None):
|
def select_month(event=None):
|
||||||
# tixDemo:Status "Month = %s" % demo_month.get()
|
# tixDemo:Status "Month = %s" % demo_month.get()
|
||||||
|
@ -97,6 +97,6 @@ def ok_command(w):
|
||||||
w.destroy()
|
w.destroy()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# integer values; one lets you select floating point values and the last
|
# integer values; one lets you select floating point values and the last
|
||||||
# one lets you select a few names.
|
# one lets you select a few names.
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ class DemoControl:
|
||||||
|
|
||||||
global demo_maker, demo_thrust, demo_num_engines
|
global demo_maker, demo_thrust, demo_num_engines
|
||||||
|
|
||||||
demo_maker = Tix.StringVar()
|
demo_maker = tkinter.tix.StringVar()
|
||||||
demo_thrust = Tix.DoubleVar()
|
demo_thrust = tkinter.tix.DoubleVar()
|
||||||
demo_num_engines = Tix.IntVar()
|
demo_num_engines = tkinter.tix.IntVar()
|
||||||
demo_maker.set('P&W')
|
demo_maker.set('P&W')
|
||||||
demo_thrust.set(20000.0)
|
demo_thrust.set(20000.0)
|
||||||
demo_num_engines.set(2)
|
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
|
# $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
|
# [Hint] We set the label.width subwidget option of the Controls to
|
||||||
# be 16 so that their labels appear to be aligned.
|
# 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,
|
variable=demo_num_engines, min=1, max=4,
|
||||||
options='entry.width 10 label.width 20 label.anchor e')
|
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,
|
min='10000.0', max='60000.0', step=500,
|
||||||
variable=demo_thrust,
|
variable=demo_thrust,
|
||||||
options='entry.width 10 label.width 20 label.anchor e')
|
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,
|
variable=demo_maker,
|
||||||
options='entry.width 10 label.width 20 label.anchor e')
|
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['decrcmd'] = lambda w=c: adjust_maker(w, -1)
|
||||||
c['validatecmd'] = lambda w=c: validate_maker(w)
|
c['validatecmd'] = lambda w=c: validate_maker(w)
|
||||||
|
|
||||||
a.pack(side=Tix.TOP, anchor=Tix.W)
|
a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
|
||||||
b.pack(side=Tix.TOP, anchor=Tix.W)
|
b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W)
|
||||||
c.pack(side=Tix.TOP, anchor=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,
|
box.add('ok', text='Ok', underline=0, width=6,
|
||||||
command=self.okcmd)
|
command=self.okcmd)
|
||||||
box.add('cancel', text='Cancel', underline=0, width=6,
|
box.add('cancel', text='Cancel', underline=0, width=6,
|
||||||
command=self.quitcmd)
|
command=self.quitcmd)
|
||||||
box.pack(side=Tix.BOTTOM, fill=Tix.X)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
|
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
def okcmd (self):
|
def okcmd (self):
|
||||||
# tixDemo:Status "Selected %d of %s engines each of thrust %d", (demo_num_engines.get(), demo_maker.get(), demo_thrust.get())
|
# 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]
|
return maker_list[i]
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
# installation directory for an application.
|
# installation directory for an application.
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix, os, copy
|
import tkinter.tix, os, copy
|
||||||
from Tkconstants import *
|
from tkinter.constants import *
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -40,25 +40,25 @@ class DemoDirList:
|
||||||
# bg = root.tk.eval('tix option get bg')
|
# bg = root.tk.eval('tix option get bg')
|
||||||
# adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0
|
# 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
|
# Create the DirList widget. By default it will show the current
|
||||||
# directory
|
# directory
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
top.dir = Tix.DirList(top)
|
top.dir = tkinter.tix.DirList(top)
|
||||||
top.dir.hlist['width'] = 40
|
top.dir.hlist['width'] = 40
|
||||||
|
|
||||||
# When the user presses the ".." button, the selected directory
|
# When the user presses the ".." button, the selected directory
|
||||||
# is "transferred" into the entry widget
|
# 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
|
# We use a LabelEntry to hold the installation directory. The user
|
||||||
# can choose from the DirList widget, or he can type in the directory
|
# can choose from the DirList widget, or he can type in the directory
|
||||||
# manually
|
# manually
|
||||||
#
|
#
|
||||||
top.ent = Tix.LabelEntry(top, label="Installation Directory:",
|
top.ent = tkinter.tix.LabelEntry(top, label="Installation Directory:",
|
||||||
labelside = 'top',
|
labelside = 'top',
|
||||||
options = '''
|
options = '''
|
||||||
entry.width 40
|
entry.width 40
|
||||||
|
@ -85,7 +85,7 @@ class DemoDirList:
|
||||||
|
|
||||||
# Use a ButtonBox to hold the buttons.
|
# 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,
|
box.add ('ok', text='Ok', underline=0, width=6,
|
||||||
command = lambda self=self: self.okcmd () )
|
command = lambda self=self: self.okcmd () )
|
||||||
box.add ('cancel', text='Cancel', underline=0, width=6,
|
box.add ('cancel', text='Cancel', underline=0, width=6,
|
||||||
|
@ -118,14 +118,14 @@ class DemoDirList:
|
||||||
# outside of the main demo program "tixwidgets.py".
|
# outside of the main demo program "tixwidgets.py".
|
||||||
#
|
#
|
||||||
if __name__== '__main__' :
|
if __name__== '__main__' :
|
||||||
import tkMessageBox, traceback
|
import tkinter.messagebox, traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
root=Tix.Tk()
|
root=tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
except:
|
except:
|
||||||
t, v, tb = sys.exc_info()
|
t, v, tb = sys.exc_info()
|
||||||
text = "Error running the demo script:\n"
|
text = "Error running the demo script:\n"
|
||||||
for line in traceback.format_exception(t,v,tb):
|
for line in traceback.format_exception(t,v,tb):
|
||||||
text = text + line + '\n'
|
text = text + line + '\n'
|
||||||
d = tkMessageBox.showerror ( 'Tix Demo Error', text)
|
d = tkinter.messagebox.showerror ( 'Tix Demo Error', text)
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
# installation directory for an application.
|
# installation directory for an application.
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix, os, copy
|
import tkinter.tix, os, copy
|
||||||
from Tkconstants import *
|
from tkinter.constants import *
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -40,25 +40,25 @@ class DemoDirTree:
|
||||||
# bg = root.tk.eval('tix option get bg')
|
# bg = root.tk.eval('tix option get bg')
|
||||||
# adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0
|
# 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
|
# Create the DirTree widget. By default it will show the current
|
||||||
# directory
|
# directory
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
top.dir = Tix.DirTree(top)
|
top.dir = tkinter.tix.DirTree(top)
|
||||||
top.dir.hlist['width'] = 40
|
top.dir.hlist['width'] = 40
|
||||||
|
|
||||||
# When the user presses the ".." button, the selected directory
|
# When the user presses the ".." button, the selected directory
|
||||||
# is "transferred" into the entry widget
|
# 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
|
# We use a LabelEntry to hold the installation directory. The user
|
||||||
# can choose from the DirTree widget, or he can type in the directory
|
# can choose from the DirTree widget, or he can type in the directory
|
||||||
# manually
|
# manually
|
||||||
#
|
#
|
||||||
top.ent = Tix.LabelEntry(top, label="Installation Directory:",
|
top.ent = tkinter.tix.LabelEntry(top, label="Installation Directory:",
|
||||||
labelside = 'top',
|
labelside = 'top',
|
||||||
options = '''
|
options = '''
|
||||||
entry.width 40
|
entry.width 40
|
||||||
|
@ -79,7 +79,7 @@ class DemoDirTree:
|
||||||
|
|
||||||
# Use a ButtonBox to hold the buttons.
|
# 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,
|
box.add ('ok', text='Ok', underline=0, width=6,
|
||||||
command = lambda self=self: self.okcmd () )
|
command = lambda self=self: self.okcmd () )
|
||||||
box.add ('cancel', text='Cancel', underline=0, width=6,
|
box.add ('cancel', text='Cancel', underline=0, width=6,
|
||||||
|
@ -113,5 +113,5 @@ class DemoDirTree:
|
||||||
# outside of the main demo program "tixwidgets.py".
|
# outside of the main demo program "tixwidgets.py".
|
||||||
#
|
#
|
||||||
if __name__== '__main__' :
|
if __name__== '__main__' :
|
||||||
root=Tix.Tk()
|
root=tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# This file demonstrates the use of the tixNoteBook widget, which allows
|
# This file demonstrates the use of the tixNoteBook widget, which allows
|
||||||
# you to lay out your interface using a "notebook" metaphore
|
# you to lay out your interface using a "notebook" metaphore
|
||||||
#
|
#
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
global root
|
global root
|
||||||
|
@ -21,20 +21,20 @@ def RunSample(w):
|
||||||
|
|
||||||
# We use these options to set the sizes of the subwidgets inside the
|
# We use these options to set the sizes of the subwidgets inside the
|
||||||
# notebook, so that they are well-aligned on the screen.
|
# notebook, so that they are well-aligned on the screen.
|
||||||
prefix = Tix.OptionName(w)
|
prefix = tkinter.tix.OptionName(w)
|
||||||
if prefix:
|
if prefix:
|
||||||
prefix = '*'+prefix
|
prefix = '*'+prefix
|
||||||
else:
|
else:
|
||||||
prefix = ''
|
prefix = ''
|
||||||
w.option_add(prefix+'*TixControl*entry.width', 10)
|
w.option_add(prefix+'*TixControl*entry.width', 10)
|
||||||
w.option_add(prefix+'*TixControl*label.width', 18)
|
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)
|
w.option_add(prefix+'*TixNoteBook*tagPadX', 8)
|
||||||
|
|
||||||
# Create the notebook widget and set its backpagecolor to gray.
|
# Create the notebook widget and set its backpagecolor to gray.
|
||||||
# Note that the -backpagecolor option belongs to the "nbframe"
|
# Note that the -backpagecolor option belongs to the "nbframe"
|
||||||
# subwidget.
|
# 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['bg'] = 'gray'
|
||||||
nb.nbframe['backpagecolor'] = 'gray'
|
nb.nbframe['backpagecolor'] = 'gray'
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ def RunSample(w):
|
||||||
nb.add('hard_disk', label="Hard Disk", underline=0)
|
nb.add('hard_disk', label="Hard Disk", underline=0)
|
||||||
nb.add('network', label="Network", 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
|
# Create the first page
|
||||||
|
@ -54,21 +54,21 @@ def RunSample(w):
|
||||||
# other widgets
|
# other widgets
|
||||||
#
|
#
|
||||||
tab=nb.hard_disk
|
tab=nb.hard_disk
|
||||||
f = Tix.Frame(tab)
|
f = tkinter.tix.Frame(tab)
|
||||||
common = Tix.Frame(tab)
|
common = tkinter.tix.Frame(tab)
|
||||||
|
|
||||||
f.pack(side=Tix.LEFT, padx=2, pady=2, fill=Tix.BOTH, expand=1)
|
f.pack(side=tkinter.tix.LEFT, padx=2, pady=2, fill=tkinter.tix.BOTH, expand=1)
|
||||||
common.pack(side=Tix.RIGHT, padx=2, fill=Tix.Y)
|
common.pack(side=tkinter.tix.RIGHT, padx=2, fill=tkinter.tix.Y)
|
||||||
|
|
||||||
a = Tix.Control(f, value=12, label='Access time: ')
|
a = tkinter.tix.Control(f, value=12, label='Access time: ')
|
||||||
w = Tix.Control(f, value=400, label='Write Throughput: ')
|
w = tkinter.tix.Control(f, value=400, label='Write Throughput: ')
|
||||||
r = Tix.Control(f, value=400, label='Read Throughput: ')
|
r = tkinter.tix.Control(f, value=400, label='Read Throughput: ')
|
||||||
c = Tix.Control(f, value=1021, label='Capacity: ')
|
c = tkinter.tix.Control(f, value=1021, label='Capacity: ')
|
||||||
|
|
||||||
a.pack(side=Tix.TOP, padx=20, pady=2)
|
a.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
w.pack(side=Tix.TOP, padx=20, pady=2)
|
w.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
r.pack(side=Tix.TOP, padx=20, pady=2)
|
r.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
c.pack(side=Tix.TOP, padx=20, pady=2)
|
c.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
|
|
||||||
# Create the common buttons
|
# Create the common buttons
|
||||||
createCommonButtons(common)
|
createCommonButtons(common)
|
||||||
|
@ -79,23 +79,23 @@ def RunSample(w):
|
||||||
|
|
||||||
tab = nb.network
|
tab = nb.network
|
||||||
|
|
||||||
f = Tix.Frame(tab)
|
f = tkinter.tix.Frame(tab)
|
||||||
common = Tix.Frame(tab)
|
common = tkinter.tix.Frame(tab)
|
||||||
|
|
||||||
f.pack(side=Tix.LEFT, padx=2, pady=2, fill=Tix.BOTH, expand=1)
|
f.pack(side=tkinter.tix.LEFT, padx=2, pady=2, fill=tkinter.tix.BOTH, expand=1)
|
||||||
common.pack(side=Tix.RIGHT, padx=2, fill=Tix.Y)
|
common.pack(side=tkinter.tix.RIGHT, padx=2, fill=tkinter.tix.Y)
|
||||||
|
|
||||||
a = Tix.Control(f, value=12, label='Access time: ')
|
a = tkinter.tix.Control(f, value=12, label='Access time: ')
|
||||||
w = Tix.Control(f, value=400, label='Write Throughput: ')
|
w = tkinter.tix.Control(f, value=400, label='Write Throughput: ')
|
||||||
r = Tix.Control(f, value=400, label='Read Throughput: ')
|
r = tkinter.tix.Control(f, value=400, label='Read Throughput: ')
|
||||||
c = Tix.Control(f, value=1021, label='Capacity: ')
|
c = tkinter.tix.Control(f, value=1021, label='Capacity: ')
|
||||||
u = Tix.Control(f, value=10, label='Users: ')
|
u = tkinter.tix.Control(f, value=10, label='Users: ')
|
||||||
|
|
||||||
a.pack(side=Tix.TOP, padx=20, pady=2)
|
a.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
w.pack(side=Tix.TOP, padx=20, pady=2)
|
w.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
r.pack(side=Tix.TOP, padx=20, pady=2)
|
r.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
c.pack(side=Tix.TOP, padx=20, pady=2)
|
c.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
u.pack(side=Tix.TOP, padx=20, pady=2)
|
u.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
|
|
||||||
createCommonButtons(common)
|
createCommonButtons(common)
|
||||||
|
|
||||||
|
@ -104,16 +104,16 @@ def doDestroy():
|
||||||
root.destroy()
|
root.destroy()
|
||||||
|
|
||||||
def createCommonButtons(master):
|
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)
|
command=doDestroy)
|
||||||
cancel = Tix.Button(master, name='cancel',
|
cancel = tkinter.tix.Button(master, name='cancel',
|
||||||
text='Cancel', width=6,
|
text='Cancel', width=6,
|
||||||
command=doDestroy)
|
command=doDestroy)
|
||||||
|
|
||||||
ok.pack(side=Tix.TOP, padx=2, pady=2)
|
ok.pack(side=tkinter.tix.TOP, padx=2, pady=2)
|
||||||
cancel.pack(side=Tix.TOP, padx=2, pady=2)
|
cancel.pack(side=tkinter.tix.TOP, padx=2, pady=2)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# This file demonstrates the use of the tixOptionMenu widget -- you can
|
# This file demonstrates the use of the tixOptionMenu widget -- you can
|
||||||
# use it for the user to choose from a fixed set of options
|
# 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',
|
options = {'text':'Plain Text', 'post':'PostScript', 'html':'HTML',
|
||||||
'tex':'LaTeX', 'rtf':'Rich Text Format'}
|
'tex':'LaTeX', 'rtf':'Rich Text Format'}
|
||||||
|
@ -21,16 +21,16 @@ options = {'text':'Plain Text', 'post':'PostScript', 'html':'HTML',
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
global demo_opt_from, demo_opt_to
|
global demo_opt_from, demo_opt_to
|
||||||
|
|
||||||
demo_opt_from = Tix.StringVar()
|
demo_opt_from = tkinter.tix.StringVar()
|
||||||
demo_opt_to = 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,
|
variable=demo_opt_from,
|
||||||
options = 'label.width 19 label.anchor e menubutton.width 15')
|
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,
|
variable=demo_opt_to,
|
||||||
options='label.width 19 label.anchor e menubutton.width 15')
|
options='label.width 19 label.anchor e menubutton.width 15')
|
||||||
|
|
||||||
|
@ -47,22 +47,22 @@ def RunSample(w):
|
||||||
demo_opt_from.set('html')
|
demo_opt_from.set('html')
|
||||||
demo_opt_to.set('post')
|
demo_opt_to.set('post')
|
||||||
|
|
||||||
from_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=Tix.TOP, anchor=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,
|
box.add('ok', text='Ok', underline=0, width=6,
|
||||||
command=lambda w=w: ok_command(w))
|
command=lambda w=w: ok_command(w))
|
||||||
box.add('cancel', text='Cancel', underline=0, width=6,
|
box.add('cancel', text='Cancel', underline=0, width=6,
|
||||||
command=lambda w=w: w.destroy())
|
command=lambda w=w: w.destroy())
|
||||||
box.pack(side=Tix.BOTTOM, fill=Tix.X)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
|
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
def ok_command(w):
|
def ok_command(w):
|
||||||
# tixDemo:Status "Convert file from %s to %s" % ( demo_opt_from.get(), demo_opt_to.get())
|
# tixDemo:Status "Convert file from %s to %s" % ( demo_opt_from.get(), demo_opt_to.get())
|
||||||
w.destroy()
|
w.destroy()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# of artical names and the size of the text widget that shows the body
|
# of artical names and the size of the text widget that shows the body
|
||||||
# of the article.
|
# of the article.
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -32,30 +32,30 @@ class DemoPanedwin:
|
||||||
z = w.winfo_toplevel()
|
z = w.winfo_toplevel()
|
||||||
z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
|
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')
|
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)
|
p1 = pane.add('list', min=70, size=100)
|
||||||
p2 = pane.add('text', min=70)
|
p2 = pane.add('text', min=70)
|
||||||
list = Tix.ScrolledListBox(p1)
|
list = tkinter.tix.ScrolledListBox(p1)
|
||||||
list.listbox['width'] = 80
|
list.listbox['width'] = 80
|
||||||
list.listbox['height'] = 5
|
list.listbox['height'] = 5
|
||||||
text = Tix.ScrolledText(p2)
|
text = tkinter.tix.ScrolledText(p2)
|
||||||
text.text['width'] = 80
|
text.text['width'] = 80
|
||||||
text.text['height'] = 20
|
text.text['height'] = 20
|
||||||
|
|
||||||
list.listbox.insert(Tix.END, " 12324 Re: Tkinter is good for your health")
|
list.listbox.insert(tkinter.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(tkinter.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(tkinter.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(tkinter.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(tkinter.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(tkinter.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, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)")
|
||||||
|
|
||||||
text.text['bg'] = list.listbox['bg']
|
text.text['bg'] = list.listbox['bg']
|
||||||
text.text['wrap'] = 'none'
|
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
|
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
|
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
|
ioi@blue.seas.upenn.edu Ioi K. Lam at University of Pennsylvania
|
||||||
|
@ -70,18 +70,18 @@ class DemoPanedwin:
|
||||||
""")
|
""")
|
||||||
text.text['state'] = 'disabled'
|
text.text['state'] = 'disabled'
|
||||||
|
|
||||||
list.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=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)
|
group.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH)
|
||||||
pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1)
|
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,
|
box.add('ok', text='Ok', underline=0, width=6,
|
||||||
command=self.quitcmd)
|
command=self.quitcmd)
|
||||||
box.add('cancel', text='Cancel', underline=0, width=6,
|
box.add('cancel', text='Cancel', underline=0, width=6,
|
||||||
command=self.quitcmd)
|
command=self.quitcmd)
|
||||||
box.pack(side=Tix.BOTTOM, fill=Tix.X)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
|
|
||||||
def quitcmd (self):
|
def quitcmd (self):
|
||||||
self.exit = 0
|
self.exit = 0
|
||||||
|
@ -94,5 +94,5 @@ class DemoPanedwin:
|
||||||
self.root.destroy()
|
self.root.destroy()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
|
|
|
@ -12,18 +12,18 @@
|
||||||
|
|
||||||
# This file demonstrates the use of the tixPopupMenu widget.
|
# This file demonstrates the use of the tixPopupMenu widget.
|
||||||
#
|
#
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
# We create the frame and the button, then we'll bind the PopupMenu
|
# 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
|
# 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.
|
# button over $w.top or $w.top.but, the PopupMenu will come up.
|
||||||
#
|
#
|
||||||
top = Tix.Frame(w, relief=Tix.RAISED, bd=1)
|
top = tkinter.tix.Frame(w, relief=tkinter.tix.RAISED, bd=1)
|
||||||
but = Tix.Button(top, text='Press the right mouse button over this button or its surrounding area')
|
but = tkinter.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)
|
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(top)
|
||||||
p.bind_widget(but)
|
p.bind_widget(but)
|
||||||
|
|
||||||
|
@ -37,21 +37,21 @@ def RunSample(w):
|
||||||
p.menu.add_command(label='Find', underline=0)
|
p.menu.add_command(label='Find', underline=0)
|
||||||
p.menu.add_command(label='System', underline=1)
|
p.menu.add_command(label='System', underline=1)
|
||||||
p.menu.add_command(label='Help', underline=0)
|
p.menu.add_command(label='Help', underline=0)
|
||||||
m1 = Tix.Menu(p.menu)
|
m1 = tkinter.tix.Menu(p.menu)
|
||||||
m1.add_command(label='Hello')
|
m1.add_command(label='Hello')
|
||||||
p.menu.add_cascade(label='More', menu=m1)
|
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,
|
box.add('ok', text='Ok', underline=0, width=6,
|
||||||
command=lambda w=w: w.destroy())
|
command=lambda w=w: w.destroy())
|
||||||
box.add('cancel', text='Cancel', underline=0, width=6,
|
box.add('cancel', text='Cancel', underline=0, width=6,
|
||||||
command=lambda w=w: w.destroy())
|
command=lambda w=w: w.destroy())
|
||||||
box.pack(side=Tix.BOTTOM, fill=Tix.X)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
|
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# This file demonstrates the use of the tixScrolledHList widget.
|
# This file demonstrates the use of the tixScrolledHList widget.
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ class DemoSHList:
|
||||||
# We create the frame and the ScrolledHList widget
|
# We create the frame and the ScrolledHList widget
|
||||||
# at the top of the dialog box
|
# 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
|
# Put a simple hierachy into the HList (two levels). Use colors and
|
||||||
# separator widgets (frames) to make the list look fancy
|
# separator widgets (frames) to make the list look fancy
|
||||||
#
|
#
|
||||||
top.a = Tix.ScrolledHList(top)
|
top.a = tkinter.tix.ScrolledHList(top)
|
||||||
top.a.pack( expand=1, fill=Tix.BOTH, padx=10, pady=10, side=Tix.TOP)
|
top.a.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP)
|
||||||
|
|
||||||
# This is our little relational database
|
# This is our little relational database
|
||||||
#
|
#
|
||||||
|
@ -68,13 +68,13 @@ class DemoSHList:
|
||||||
count=0
|
count=0
|
||||||
for boss,name in bosses :
|
for boss,name in bosses :
|
||||||
if count :
|
if count :
|
||||||
f=Tix.Frame(hlist, name='sep%d' % count, height=2, width=150,
|
f=tkinter.tix.Frame(hlist, name='sep%d' % count, height=2, width=150,
|
||||||
bd=2, relief=Tix.SUNKEN )
|
bd=2, relief=tkinter.tix.SUNKEN )
|
||||||
|
|
||||||
hlist.add_child( itemtype=Tix.WINDOW,
|
hlist.add_child( itemtype=tkinter.tix.WINDOW,
|
||||||
window=f, state=Tix.DISABLED )
|
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
|
count = count+1
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,15 +99,15 @@ class DemoSHList:
|
||||||
|
|
||||||
# Use a ButtonBox to hold the buttons.
|
# 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,
|
box.add( 'ok', text='Ok', underline=0, width=6,
|
||||||
command = self.okcmd)
|
command = self.okcmd)
|
||||||
|
|
||||||
box.add( 'cancel', text='Cancel', underline=0, width=6,
|
box.add( 'cancel', text='Cancel', underline=0, width=6,
|
||||||
command = self.quitcmd)
|
command = self.quitcmd)
|
||||||
|
|
||||||
box.pack( side=Tix.BOTTOM, fill=Tix.X)
|
box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack( side=Tix.TOP, fill=Tix.BOTH, expand=1 )
|
top.pack( side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1 )
|
||||||
|
|
||||||
def okcmd (self):
|
def okcmd (self):
|
||||||
self.quitcmd()
|
self.quitcmd()
|
||||||
|
@ -127,5 +127,5 @@ class DemoSHList:
|
||||||
# outside of the main demo program "tixwidgets.py".
|
# outside of the main demo program "tixwidgets.py".
|
||||||
#
|
#
|
||||||
if __name__== '__main__' :
|
if __name__== '__main__' :
|
||||||
root=Tix.Tk()
|
root=tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# In a tixHList widget, you can have one ore more columns.
|
# In a tixHList widget, you can have one ore more columns.
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix
|
import tkinter.tix
|
||||||
|
|
||||||
TCL_ALL_EVENTS = 0
|
TCL_ALL_EVENTS = 0
|
||||||
|
|
||||||
|
@ -36,13 +36,13 @@ class DemoSHList:
|
||||||
# We create the frame and the ScrolledHList widget
|
# We create the frame and the ScrolledHList widget
|
||||||
# at the top of the dialog box
|
# 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
|
# Put a simple hierachy into the HList (two levels). Use colors and
|
||||||
# separator widgets (frames) to make the list look fancy
|
# separator widgets (frames) to make the list look fancy
|
||||||
#
|
#
|
||||||
top.a = Tix.ScrolledHList(top, options='hlist.columns 3 hlist.header 1' )
|
top.a = tkinter.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.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP)
|
||||||
|
|
||||||
hlist=top.a.hlist
|
hlist=top.a.hlist
|
||||||
|
|
||||||
|
@ -55,12 +55,12 @@ class DemoSHList:
|
||||||
|
|
||||||
# First some styles for the headers
|
# First some styles for the headers
|
||||||
style={}
|
style={}
|
||||||
style['header'] = Tix.DisplayStyle(Tix.TEXT, refwindow=hlist,
|
style['header'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist,
|
||||||
anchor=Tix.CENTER, padx=8, pady=2, font = boldfont )
|
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'])
|
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'])
|
style=style['header'])
|
||||||
|
|
||||||
# Notice that we use 3 columns in the hlist widget. This way when the user
|
# 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')
|
('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
|
# Let configure the appearance of the HList subwidget
|
||||||
#
|
#
|
||||||
|
@ -105,9 +105,9 @@ class DemoSHList:
|
||||||
|
|
||||||
# Create the boss
|
# Create the boss
|
||||||
#
|
#
|
||||||
hlist.add ('.', itemtype=Tix.TEXT, text=boss[1],
|
hlist.add ('.', itemtype=tkinter.tix.TEXT, text=boss[1],
|
||||||
style=style['mgr_name'])
|
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'])
|
style=style['mgr_posn'])
|
||||||
|
|
||||||
# Create the managers
|
# Create the managers
|
||||||
|
@ -115,9 +115,9 @@ class DemoSHList:
|
||||||
|
|
||||||
for key,name,posn in managers :
|
for key,name,posn in managers :
|
||||||
e= '.'+ key
|
e= '.'+ key
|
||||||
hlist.add(e, itemtype=Tix.TEXT, text=name,
|
hlist.add(e, itemtype=tkinter.tix.TEXT, text=name,
|
||||||
style=style['mgr_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'])
|
style=style['mgr_posn'])
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,21 +130,21 @@ class DemoSHList:
|
||||||
# parent entryPath / child's name
|
# parent entryPath / child's name
|
||||||
|
|
||||||
hlist.add(entrypath, text=name, style=style['empl_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'] )
|
text = posn, style = style['empl_posn'] )
|
||||||
|
|
||||||
|
|
||||||
# Use a ButtonBox to hold the buttons.
|
# 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,
|
box.add( 'ok', text='Ok', underline=0, width=6,
|
||||||
command = self.okcmd )
|
command = self.okcmd )
|
||||||
|
|
||||||
box.add( 'cancel', text='Cancel', underline=0, width=6,
|
box.add( 'cancel', text='Cancel', underline=0, width=6,
|
||||||
command = self.quitcmd )
|
command = self.quitcmd )
|
||||||
|
|
||||||
box.pack( side=Tix.BOTTOM, fill=Tix.X)
|
box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack( side=Tix.TOP, fill=Tix.BOTH, expand=1 )
|
top.pack( side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1 )
|
||||||
|
|
||||||
def okcmd (self):
|
def okcmd (self):
|
||||||
self.quitcmd()
|
self.quitcmd()
|
||||||
|
@ -164,5 +164,5 @@ class DemoSHList:
|
||||||
# outside of the main demo program "tixwidgets.py".
|
# outside of the main demo program "tixwidgets.py".
|
||||||
#
|
#
|
||||||
if __name__== '__main__' :
|
if __name__== '__main__' :
|
||||||
root=Tix.Tk()
|
root=tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
|
|
|
@ -14,30 +14,30 @@
|
||||||
# dynamic hierachical data (the files in the Unix file system)
|
# dynamic hierachical data (the files in the Unix file system)
|
||||||
#
|
#
|
||||||
|
|
||||||
import Tix, os
|
import tkinter.tix, os
|
||||||
|
|
||||||
def RunSample(w):
|
def RunSample(w):
|
||||||
top = Tix.Frame(w, relief=Tix.RAISED, bd=1)
|
top = tkinter.tix.Frame(w, relief=tkinter.tix.RAISED, bd=1)
|
||||||
tree = Tix.Tree(top, options='separator "/"')
|
tree = tkinter.tix.Tree(top, options='separator "/"')
|
||||||
tree.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10, side=Tix.LEFT)
|
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)
|
tree['opencmd'] = lambda dir=None, w=tree: opendir(w, dir)
|
||||||
|
|
||||||
# The / directory is added in the "open" mode. The user can open it
|
# The / directory is added in the "open" mode. The user can open it
|
||||||
# and then browse its subdirectories ...
|
# and then browse its subdirectories ...
|
||||||
adddir(tree, "/")
|
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('ok', text='Ok', underline=0, command=w.destroy, width=6)
|
||||||
box.add('cancel', text='Cancel', 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)
|
box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X)
|
||||||
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
|
top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
def adddir(tree, dir):
|
def adddir(tree, dir):
|
||||||
if dir == '/':
|
if dir == '/':
|
||||||
text = '/'
|
text = '/'
|
||||||
else:
|
else:
|
||||||
text = os.path.basename(dir)
|
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'))
|
image=tree.tk.call('tix', 'getimage', 'folder'))
|
||||||
try:
|
try:
|
||||||
os.listdir(dir)
|
os.listdir(dir)
|
||||||
|
@ -71,10 +71,10 @@ def opendir(tree, dir):
|
||||||
if os.path.isdir(dir + '/' + file):
|
if os.path.isdir(dir + '/' + file):
|
||||||
adddir(tree, dir + '/' + file)
|
adddir(tree, dir + '/' + file)
|
||||||
else:
|
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'))
|
image=tree.tk.call('tix', 'getimage', 'file'))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunSample(root)
|
RunSample(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
# % python tixwidgets.py
|
# % python tixwidgets.py
|
||||||
#
|
#
|
||||||
|
|
||||||
import os, os.path, sys, Tix
|
import os, os.path, sys, tkinter.tix
|
||||||
from Tkconstants import *
|
from tkinter.constants import *
|
||||||
import traceback, tkMessageBox
|
import traceback, tkinter.messagebox
|
||||||
|
|
||||||
TCL_DONT_WAIT = 1<<1
|
TCL_DONT_WAIT = 1<<1
|
||||||
TCL_WINDOW_EVENTS = 1<<2
|
TCL_WINDOW_EVENTS = 1<<2
|
||||||
|
@ -30,7 +30,7 @@ class Demo:
|
||||||
|
|
||||||
self.dir = None # script directory
|
self.dir = None # script directory
|
||||||
self.balloon = None # balloon widget
|
self.balloon = None # balloon widget
|
||||||
self.useBalloons = Tix.StringVar()
|
self.useBalloons = tkinter.tix.StringVar()
|
||||||
self.useBalloons.set('0')
|
self.useBalloons.set('0')
|
||||||
self.statusbar = None # status bar widget
|
self.statusbar = None # status bar widget
|
||||||
self.welmsg = None # Msg widget
|
self.welmsg = None # Msg widget
|
||||||
|
@ -56,14 +56,14 @@ class Demo:
|
||||||
|
|
||||||
def MkMainMenu(self):
|
def MkMainMenu(self):
|
||||||
top = self.root
|
top = self.root
|
||||||
w = Tix.Frame(top, bd=2, relief=RAISED)
|
w = tkinter.tix.Frame(top, bd=2, relief=RAISED)
|
||||||
file = Tix.Menubutton(w, text='File', underline=0, takefocus=0)
|
file = tkinter.tix.Menubutton(w, text='File', underline=0, takefocus=0)
|
||||||
help = Tix.Menubutton(w, text='Help', underline=0, takefocus=0)
|
help = tkinter.tix.Menubutton(w, text='Help', underline=0, takefocus=0)
|
||||||
file.pack(side=LEFT)
|
file.pack(side=LEFT)
|
||||||
help.pack(side=RIGHT)
|
help.pack(side=RIGHT)
|
||||||
fm = Tix.Menu(file, tearoff=0)
|
fm = tkinter.tix.Menu(file, tearoff=0)
|
||||||
file['menu'] = fm
|
file['menu'] = fm
|
||||||
hm = Tix.Menu(help, tearoff=0)
|
hm = tkinter.tix.Menu(help, tearoff=0)
|
||||||
help['menu'] = hm
|
help['menu'] = hm
|
||||||
|
|
||||||
fm.add_command(label='Exit', underline=1,
|
fm.add_command(label='Exit', underline=1,
|
||||||
|
@ -77,7 +77,7 @@ class Demo:
|
||||||
|
|
||||||
def MkMainNotebook(self):
|
def MkMainNotebook(self):
|
||||||
top = self.root
|
top = self.root
|
||||||
w = Tix.NoteBook(top, ipadx=5, ipady=5, options="""
|
w = tkinter.tix.NoteBook(top, ipadx=5, ipady=5, options="""
|
||||||
tagPadX 6
|
tagPadX 6
|
||||||
tagPadY 4
|
tagPadY 4
|
||||||
borderWidth 2
|
borderWidth 2
|
||||||
|
@ -103,8 +103,8 @@ class Demo:
|
||||||
global demo
|
global demo
|
||||||
top = self.root
|
top = self.root
|
||||||
|
|
||||||
w = Tix.Frame(top, relief=Tix.RAISED, bd=1)
|
w = tkinter.tix.Frame(top, relief=tkinter.tix.RAISED, bd=1)
|
||||||
demo.statusbar = Tix.Label(w, relief=Tix.SUNKEN, 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')
|
demo.statusbar.form(padx=3, pady=3, left=0, right='%70')
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class Demo:
|
||||||
z.geometry('790x590+10+10')
|
z.geometry('790x590+10+10')
|
||||||
else:
|
else:
|
||||||
z.geometry('890x640+10+10')
|
z.geometry('890x640+10+10')
|
||||||
demo.balloon = Tix.Balloon(root)
|
demo.balloon = tkinter.tix.Balloon(root)
|
||||||
frame1 = self.MkMainMenu()
|
frame1 = self.MkMainMenu()
|
||||||
frame2 = self.MkMainNotebook()
|
frame2 = self.MkMainNotebook()
|
||||||
frame3 = self.MkMainStatus()
|
frame3 = self.MkMainStatus()
|
||||||
|
@ -152,7 +152,7 @@ class Demo:
|
||||||
self.exit = 1
|
self.exit = 1
|
||||||
return
|
return
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes':
|
if tkinter.messagebox.askquestion ('Interrupt', 'Really Quit?') == 'yes':
|
||||||
# self.tk.eval('exit')
|
# self.tk.eval('exit')
|
||||||
self.exit = 1
|
self.exit = 1
|
||||||
return
|
return
|
||||||
|
@ -163,7 +163,7 @@ class Demo:
|
||||||
text = ""
|
text = ""
|
||||||
for line in traceback.format_exception(t,v,tb):
|
for line in traceback.format_exception(t,v,tb):
|
||||||
text += line + '\n'
|
text += line + '\n'
|
||||||
try: tkMessageBox.showerror ('Error', text)
|
try: tkinter.messagebox.showerror ('Error', text)
|
||||||
except: pass
|
except: pass
|
||||||
self.exit = 1
|
self.exit = 1
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
@ -191,9 +191,9 @@ def MkWelcome(nb, name):
|
||||||
def MkWelcomeBar(top):
|
def MkWelcomeBar(top):
|
||||||
global demo
|
global demo
|
||||||
|
|
||||||
w = Tix.Frame(top, bd=2, relief=Tix.GROOVE)
|
w = tkinter.tix.Frame(top, bd=2, relief=tkinter.tix.GROOVE)
|
||||||
b1 = Tix.ComboBox(w, command=lambda w=top: MainTextFont(w))
|
b1 = tkinter.tix.ComboBox(w, command=lambda w=top: MainTextFont(w))
|
||||||
b2 = 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.entry['width'] = 15
|
||||||
b1.slistbox.listbox['height'] = 3
|
b1.slistbox.listbox['height'] = 3
|
||||||
b2.entry['width'] = 4
|
b2.entry['width'] = 4
|
||||||
|
@ -202,22 +202,22 @@ def MkWelcomeBar(top):
|
||||||
demo.welfont = b1
|
demo.welfont = b1
|
||||||
demo.welsize = b2
|
demo.welsize = b2
|
||||||
|
|
||||||
b1.insert(Tix.END, 'Courier')
|
b1.insert(tkinter.tix.END, 'Courier')
|
||||||
b1.insert(Tix.END, 'Helvetica')
|
b1.insert(tkinter.tix.END, 'Helvetica')
|
||||||
b1.insert(Tix.END, 'Lucida')
|
b1.insert(tkinter.tix.END, 'Lucida')
|
||||||
b1.insert(Tix.END, 'Times Roman')
|
b1.insert(tkinter.tix.END, 'Times Roman')
|
||||||
|
|
||||||
b2.insert(Tix.END, '8')
|
b2.insert(tkinter.tix.END, '8')
|
||||||
b2.insert(Tix.END, '10')
|
b2.insert(tkinter.tix.END, '10')
|
||||||
b2.insert(Tix.END, '12')
|
b2.insert(tkinter.tix.END, '12')
|
||||||
b2.insert(Tix.END, '14')
|
b2.insert(tkinter.tix.END, '14')
|
||||||
b2.insert(Tix.END, '18')
|
b2.insert(tkinter.tix.END, '18')
|
||||||
|
|
||||||
b1.pick(1)
|
b1.pick(1)
|
||||||
b2.pick(3)
|
b2.pick(3)
|
||||||
|
|
||||||
b1.pack(side=Tix.LEFT, padx=4, pady=4)
|
b1.pack(side=tkinter.tix.LEFT, padx=4, pady=4)
|
||||||
b2.pack(side=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',
|
demo.balloon.bind_widget(b1, msg='Choose\na font',
|
||||||
statusmsg='Choose a font for this page')
|
statusmsg='Choose a font for this page')
|
||||||
|
@ -228,20 +228,20 @@ def MkWelcomeBar(top):
|
||||||
def MkWelcomeText(top):
|
def MkWelcomeText(top):
|
||||||
global demo
|
global demo
|
||||||
|
|
||||||
w = Tix.ScrolledWindow(top, scrollbar='auto')
|
w = tkinter.tix.ScrolledWindow(top, scrollbar='auto')
|
||||||
win = w.window
|
win = w.window
|
||||||
text = 'Welcome to TIX in Python'
|
text = 'Welcome to TIX in Python'
|
||||||
title = Tix.Label(win,
|
title = tkinter.tix.Label(win,
|
||||||
bd=0, width=30, anchor=Tix.N, text=text)
|
bd=0, width=30, anchor=tkinter.tix.N, text=text)
|
||||||
msg = Tix.Message(win,
|
msg = tkinter.tix.Message(win,
|
||||||
bd=0, width=400, anchor=Tix.N,
|
bd=0, width=400, anchor=tkinter.tix.N,
|
||||||
text='Tix is a set of mega-widgets based on TK. This program \
|
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 \
|
demonstrates the widgets in the Tix widget set. You can choose the pages \
|
||||||
in this window to look at the corresponding widgets. \n\n\
|
in this window to look at the corresponding widgets. \n\n\
|
||||||
To quit this program, choose the "File | Exit" command.\n\n\
|
To quit this program, choose the "File | Exit" command.\n\n\
|
||||||
For more information, see http://tix.sourceforge.net.')
|
For more information, see http://tix.sourceforge.net.')
|
||||||
title.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=Tix.BOTH, padx=10, pady=10)
|
msg.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10)
|
||||||
demo.welmsg = msg
|
demo.welmsg = msg
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
@ -267,14 +267,14 @@ def MkChoosers(nb, name):
|
||||||
w = nb.page(name)
|
w = nb.page(name)
|
||||||
options = "label.padX 4"
|
options = "label.padX 4"
|
||||||
|
|
||||||
til = Tix.LabelFrame(w, label='Chooser Widgets', options=options)
|
til = tkinter.tix.LabelFrame(w, label='Chooser Widgets', options=options)
|
||||||
cbx = Tix.LabelFrame(w, label='tixComboBox', options=options)
|
cbx = tkinter.tix.LabelFrame(w, label='tixComboBox', options=options)
|
||||||
ctl = Tix.LabelFrame(w, label='tixControl', options=options)
|
ctl = tkinter.tix.LabelFrame(w, label='tixControl', options=options)
|
||||||
sel = Tix.LabelFrame(w, label='tixSelect', options=options)
|
sel = tkinter.tix.LabelFrame(w, label='tixSelect', options=options)
|
||||||
opt = Tix.LabelFrame(w, label='tixOptionMenu', options=options)
|
opt = tkinter.tix.LabelFrame(w, label='tixOptionMenu', options=options)
|
||||||
fil = Tix.LabelFrame(w, label='tixFileEntry', options=options)
|
fil = tkinter.tix.LabelFrame(w, label='tixFileEntry', options=options)
|
||||||
fbx = Tix.LabelFrame(w, label='tixFileSelectBox', options=options)
|
fbx = tkinter.tix.LabelFrame(w, label='tixFileSelectBox', options=options)
|
||||||
tbr = Tix.LabelFrame(w, label='Tool Bar', options=options)
|
tbr = tkinter.tix.LabelFrame(w, label='Tool Bar', options=options)
|
||||||
|
|
||||||
MkTitle(til.frame)
|
MkTitle(til.frame)
|
||||||
MkCombo(cbx.frame)
|
MkCombo(cbx.frame)
|
||||||
|
@ -301,38 +301,38 @@ def MkChoosers(nb, name):
|
||||||
fbx.form(right=-1, top=0, left='%66')
|
fbx.form(right=-1, top=0, left='%66')
|
||||||
|
|
||||||
def MkCombo(w):
|
def MkCombo(w):
|
||||||
options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 14)
|
options="label.width %d label.anchor %s entry.width %d" % (10, tkinter.tix.E, 14)
|
||||||
|
|
||||||
static = Tix.ComboBox(w, label='Static', editable=0, options=options)
|
static = tkinter.tix.ComboBox(w, label='Static', editable=0, options=options)
|
||||||
editable = Tix.ComboBox(w, label='Editable', editable=1, options=options)
|
editable = tkinter.tix.ComboBox(w, label='Editable', editable=1, options=options)
|
||||||
history = Tix.ComboBox(w, label='History', editable=1, history=1,
|
history = tkinter.tix.ComboBox(w, label='History', editable=1, history=1,
|
||||||
anchor=Tix.E, options=options)
|
anchor=tkinter.tix.E, options=options)
|
||||||
static.insert(Tix.END, 'January')
|
static.insert(tkinter.tix.END, 'January')
|
||||||
static.insert(Tix.END, 'February')
|
static.insert(tkinter.tix.END, 'February')
|
||||||
static.insert(Tix.END, 'March')
|
static.insert(tkinter.tix.END, 'March')
|
||||||
static.insert(Tix.END, 'April')
|
static.insert(tkinter.tix.END, 'April')
|
||||||
static.insert(Tix.END, 'May')
|
static.insert(tkinter.tix.END, 'May')
|
||||||
static.insert(Tix.END, 'June')
|
static.insert(tkinter.tix.END, 'June')
|
||||||
static.insert(Tix.END, 'July')
|
static.insert(tkinter.tix.END, 'July')
|
||||||
static.insert(Tix.END, 'August')
|
static.insert(tkinter.tix.END, 'August')
|
||||||
static.insert(Tix.END, 'September')
|
static.insert(tkinter.tix.END, 'September')
|
||||||
static.insert(Tix.END, 'October')
|
static.insert(tkinter.tix.END, 'October')
|
||||||
static.insert(Tix.END, 'November')
|
static.insert(tkinter.tix.END, 'November')
|
||||||
static.insert(Tix.END, 'December')
|
static.insert(tkinter.tix.END, 'December')
|
||||||
|
|
||||||
editable.insert(Tix.END, 'Angola')
|
editable.insert(tkinter.tix.END, 'Angola')
|
||||||
editable.insert(Tix.END, 'Bangladesh')
|
editable.insert(tkinter.tix.END, 'Bangladesh')
|
||||||
editable.insert(Tix.END, 'China')
|
editable.insert(tkinter.tix.END, 'China')
|
||||||
editable.insert(Tix.END, 'Denmark')
|
editable.insert(tkinter.tix.END, 'Denmark')
|
||||||
editable.insert(Tix.END, 'Ecuador')
|
editable.insert(tkinter.tix.END, 'Ecuador')
|
||||||
|
|
||||||
history.insert(Tix.END, '/usr/bin/ksh')
|
history.insert(tkinter.tix.END, '/usr/bin/ksh')
|
||||||
history.insert(Tix.END, '/usr/local/lib/python')
|
history.insert(tkinter.tix.END, '/usr/local/lib/python')
|
||||||
history.insert(Tix.END, '/var/adm')
|
history.insert(tkinter.tix.END, '/var/adm')
|
||||||
|
|
||||||
static.pack(side=Tix.TOP, padx=5, pady=3)
|
static.pack(side=tkinter.tix.TOP, padx=5, pady=3)
|
||||||
editable.pack(side=Tix.TOP, padx=5, pady=3)
|
editable.pack(side=tkinter.tix.TOP, padx=5, pady=3)
|
||||||
history.pack(side=Tix.TOP, padx=5, pady=3)
|
history.pack(side=tkinter.tix.TOP, padx=5, pady=3)
|
||||||
|
|
||||||
states = ['Bengal', 'Delhi', 'Karnataka', 'Tamil Nadu']
|
states = ['Bengal', 'Delhi', 'Karnataka', 'Tamil Nadu']
|
||||||
|
|
||||||
|
@ -359,30 +359,30 @@ def spin_validate(w):
|
||||||
def MkControl(w):
|
def MkControl(w):
|
||||||
global demo_spintxt
|
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])
|
demo_spintxt.set(states[0])
|
||||||
simple = Tix.Control(w, label='Numbers', options=options)
|
simple = tkinter.tix.Control(w, label='Numbers', options=options)
|
||||||
spintxt = Tix.Control(w, label='States', variable=demo_spintxt,
|
spintxt = tkinter.tix.Control(w, label='States', variable=demo_spintxt,
|
||||||
options=options)
|
options=options)
|
||||||
spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1)
|
spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1)
|
||||||
spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1)
|
spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1)
|
||||||
spintxt['validatecmd'] = lambda w=spintxt: spin_validate(w)
|
spintxt['validatecmd'] = lambda w=spintxt: spin_validate(w)
|
||||||
|
|
||||||
simple.pack(side=Tix.TOP, padx=5, pady=3)
|
simple.pack(side=tkinter.tix.TOP, padx=5, pady=3)
|
||||||
spintxt.pack(side=Tix.TOP, padx=5, pady=3)
|
spintxt.pack(side=tkinter.tix.TOP, padx=5, pady=3)
|
||||||
|
|
||||||
def MkSelect(w):
|
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,
|
sel1 = tkinter.tix.Select(w, label='Mere Mortals', allowzero=1, radio=1,
|
||||||
orientation=Tix.VERTICAL,
|
orientation=tkinter.tix.VERTICAL,
|
||||||
labelside=Tix.TOP,
|
labelside=tkinter.tix.TOP,
|
||||||
options=options)
|
options=options)
|
||||||
sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0,
|
sel2 = tkinter.tix.Select(w, label='Geeks', allowzero=1, radio=0,
|
||||||
orientation=Tix.VERTICAL,
|
orientation=tkinter.tix.VERTICAL,
|
||||||
labelside= Tix.TOP,
|
labelside= tkinter.tix.TOP,
|
||||||
options=options)
|
options=options)
|
||||||
|
|
||||||
sel1.add('eat', text='Eat')
|
sel1.add('eat', text='Eat')
|
||||||
|
@ -397,13 +397,13 @@ def MkSelect(w):
|
||||||
sel2.add('prog3', text='Program')
|
sel2.add('prog3', text='Program')
|
||||||
sel2.add('sleep', text='Sleep')
|
sel2.add('sleep', text='Sleep')
|
||||||
|
|
||||||
sel1.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=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
|
sel2.pack(side=tkinter.tix.LEFT, padx=5, pady=3, fill=tkinter.tix.X)
|
||||||
|
|
||||||
def MkOptMenu(w):
|
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('text', label='Plain Text')
|
||||||
m.add_command('post', label='PostScript')
|
m.add_command('post', label='PostScript')
|
||||||
m.add_command('format', label='Formatted Text')
|
m.add_command('format', label='Formatted Text')
|
||||||
|
@ -412,27 +412,27 @@ def MkOptMenu(w):
|
||||||
m.add_command('tex', label='LaTeX')
|
m.add_command('tex', label='LaTeX')
|
||||||
m.add_command('rtf', label='Rich Text Format')
|
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):
|
def MkFileEnt(w):
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N,
|
||||||
text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
|
text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
|
||||||
ent = Tix.FileEntry(w, label='Select a file : ')
|
ent = tkinter.tix.FileEntry(w, label='Select a file : ')
|
||||||
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)
|
||||||
ent.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
|
ent.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3)
|
||||||
|
|
||||||
def MkFileBox(w):
|
def MkFileBox(w):
|
||||||
"""The FileSelectBox is a Motif-style box with various enhancements.
|
"""The FileSelectBox is a Motif-style box with various enhancements.
|
||||||
For example, you can adjust the size of the two listboxes
|
For example, you can adjust the size of the two listboxes
|
||||||
and your past selections are recorded.
|
and your past selections are recorded.
|
||||||
"""
|
"""
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
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.')
|
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)
|
box = tkinter.tix.FileSelectBox(w)
|
||||||
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)
|
||||||
box.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
|
box.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3)
|
||||||
|
|
||||||
def MkToolBar(w):
|
def MkToolBar(w):
|
||||||
"""The Select widget is also good for arranging buttons in a tool bar.
|
"""The Select widget is also good for arranging buttons in a tool bar.
|
||||||
|
@ -441,12 +441,12 @@ def MkToolBar(w):
|
||||||
|
|
||||||
options='frame.borderWidth 1'
|
options='frame.borderWidth 1'
|
||||||
|
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N,
|
||||||
text='The Select widget is also good for arranging buttons in a tool bar.')
|
text='The Select widget is also good for arranging buttons in a tool bar.')
|
||||||
bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
|
bar = tkinter.tix.Frame(w, bd=2, relief=tkinter.tix.RAISED)
|
||||||
font = Tix.Select(w, allowzero=1, radio=0, label='', options=options)
|
font = tkinter.tix.Select(w, allowzero=1, radio=0, label='', options=options)
|
||||||
para = Tix.Select(w, allowzero=0, radio=1, 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('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm')
|
||||||
font.add('italic', bitmap='@' + demo.dir + '/bitmaps/italic.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('center', bitmap='@' + demo.dir + '/bitmaps/centerj.xbm')
|
||||||
para.add('justify', bitmap='@' + demo.dir + '/bitmaps/justify.xbm')
|
para.add('justify', bitmap='@' + demo.dir + '/bitmaps/justify.xbm')
|
||||||
|
|
||||||
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)
|
||||||
bar.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
|
bar.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3)
|
||||||
font.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3)
|
font.pack({'in':bar}, side=tkinter.tix.LEFT, padx=3, pady=3)
|
||||||
para.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3)
|
para.pack({'in':bar}, side=tkinter.tix.LEFT, padx=3, pady=3)
|
||||||
|
|
||||||
def MkTitle(w):
|
def MkTitle(w):
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
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')
|
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):
|
def MkScroll(nb, name):
|
||||||
w = nb.page(name)
|
w = nb.page(name)
|
||||||
options='label.padX 4'
|
options='label.padX 4'
|
||||||
|
|
||||||
sls = Tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options)
|
sls = tkinter.tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options)
|
||||||
swn = Tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options)
|
swn = tkinter.tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options)
|
||||||
stx = Tix.LabelFrame(w, label='Tix.ScrolledText', options=options)
|
stx = tkinter.tix.LabelFrame(w, label='Tix.ScrolledText', options=options)
|
||||||
|
|
||||||
MkSList(sls.frame)
|
MkSList(sls.frame)
|
||||||
MkSWindow(swn.frame)
|
MkSWindow(swn.frame)
|
||||||
|
@ -490,31 +490,31 @@ def MkSList(w):
|
||||||
"""This TixScrolledListBox is configured so that it uses scrollbars
|
"""This TixScrolledListBox is configured so that it uses scrollbars
|
||||||
only when it is necessary. Use the handles to resize the listbox and
|
only when it is necessary. Use the handles to resize the listbox and
|
||||||
watch the scrollbars automatically appear and disappear. """
|
watch the scrollbars automatically appear and disappear. """
|
||||||
top = Tix.Frame(w, width=300, height=330)
|
top = tkinter.tix.Frame(w, width=300, height=330)
|
||||||
bot = Tix.Frame(w)
|
bot = tkinter.tix.Frame(w)
|
||||||
msg = Tix.Message(top,
|
msg = tkinter.tix.Message(top,
|
||||||
relief=Tix.FLAT, width=200, anchor=Tix.N,
|
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.')
|
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.place(x=50, y=150, width=120, height=80)
|
||||||
list.listbox.insert(Tix.END, 'Alabama')
|
list.listbox.insert(tkinter.tix.END, 'Alabama')
|
||||||
list.listbox.insert(Tix.END, 'California')
|
list.listbox.insert(tkinter.tix.END, 'California')
|
||||||
list.listbox.insert(Tix.END, 'Montana')
|
list.listbox.insert(tkinter.tix.END, 'Montana')
|
||||||
list.listbox.insert(Tix.END, 'New Jersey')
|
list.listbox.insert(tkinter.tix.END, 'New Jersey')
|
||||||
list.listbox.insert(Tix.END, 'New York')
|
list.listbox.insert(tkinter.tix.END, 'New York')
|
||||||
list.listbox.insert(Tix.END, 'Pennsylvania')
|
list.listbox.insert(tkinter.tix.END, 'Pennsylvania')
|
||||||
list.listbox.insert(Tix.END, 'Washington')
|
list.listbox.insert(tkinter.tix.END, 'Washington')
|
||||||
|
|
||||||
rh = Tix.ResizeHandle(top, bg='black',
|
rh = tkinter.tix.ResizeHandle(top, bg='black',
|
||||||
relief=Tix.RAISED,
|
relief=tkinter.tix.RAISED,
|
||||||
handlesize=8, gridded=1, minwidth=50, minheight=30)
|
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)
|
top.propagate(0)
|
||||||
msg.pack(fill=Tix.X)
|
msg.pack(fill=tkinter.tix.X)
|
||||||
btn.pack(anchor=Tix.CENTER)
|
btn.pack(anchor=tkinter.tix.CENTER)
|
||||||
top.pack(expand=1, fill=Tix.BOTH)
|
top.pack(expand=1, fill=tkinter.tix.BOTH)
|
||||||
bot.pack(fill=Tix.BOTH)
|
bot.pack(fill=tkinter.tix.BOTH)
|
||||||
list.bind('<Map>', func=lambda arg=0, rh=rh, list=list:
|
list.bind('<Map>', func=lambda arg=0, rh=rh, list=list:
|
||||||
list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
|
list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
|
||||||
|
|
||||||
|
@ -535,29 +535,29 @@ def MkSWindow(w):
|
||||||
if not os.path.isfile(file):
|
if not os.path.isfile(file):
|
||||||
text += ' (Image missing)'
|
text += ' (Image missing)'
|
||||||
|
|
||||||
top = Tix.Frame(w, width=330, height=330)
|
top = tkinter.tix.Frame(w, width=330, height=330)
|
||||||
bot = Tix.Frame(w)
|
bot = tkinter.tix.Frame(w)
|
||||||
msg = Tix.Message(top,
|
msg = tkinter.tix.Message(top,
|
||||||
relief=Tix.FLAT, width=200, anchor=Tix.N,
|
relief=tkinter.tix.FLAT, width=200, anchor=tkinter.tix.N,
|
||||||
text=text)
|
text=text)
|
||||||
|
|
||||||
win = Tix.ScrolledWindow(top, scrollbar='auto')
|
win = tkinter.tix.ScrolledWindow(top, scrollbar='auto')
|
||||||
|
|
||||||
image1 = win.window.image_create('photo', file=file)
|
image1 = win.window.image_create('photo', file=file)
|
||||||
lbl = Tix.Label(win.window, image=image1)
|
lbl = tkinter.tix.Label(win.window, image=image1)
|
||||||
lbl.pack(expand=1, fill=Tix.BOTH)
|
lbl.pack(expand=1, fill=tkinter.tix.BOTH)
|
||||||
|
|
||||||
win.place(x=30, y=150, width=190, height=120)
|
win.place(x=30, y=150, width=190, height=120)
|
||||||
|
|
||||||
rh = Tix.ResizeHandle(top, bg='black',
|
rh = tkinter.tix.ResizeHandle(top, bg='black',
|
||||||
relief=Tix.RAISED,
|
relief=tkinter.tix.RAISED,
|
||||||
handlesize=8, gridded=1, minwidth=50, minheight=30)
|
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)
|
top.propagate(0)
|
||||||
msg.pack(fill=Tix.X)
|
msg.pack(fill=tkinter.tix.X)
|
||||||
btn.pack(anchor=Tix.CENTER)
|
btn.pack(anchor=tkinter.tix.CENTER)
|
||||||
top.pack(expand=1, fill=Tix.BOTH)
|
top.pack(expand=1, fill=tkinter.tix.BOTH)
|
||||||
bot.pack(fill=Tix.BOTH)
|
bot.pack(fill=tkinter.tix.BOTH)
|
||||||
|
|
||||||
win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
|
win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
|
||||||
win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
|
win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
|
||||||
|
@ -570,15 +570,15 @@ def SWindow_reset(rh, win):
|
||||||
def MkSText(w):
|
def MkSText(w):
|
||||||
"""The TixScrolledWindow widget allows you to scroll any kind of Tk
|
"""The TixScrolledWindow widget allows you to scroll any kind of Tk
|
||||||
widget. It is more versatile than a scrolled canvas widget."""
|
widget. It is more versatile than a scrolled canvas widget."""
|
||||||
top = Tix.Frame(w, width=330, height=330)
|
top = tkinter.tix.Frame(w, width=330, height=330)
|
||||||
bot = Tix.Frame(w)
|
bot = tkinter.tix.Frame(w)
|
||||||
msg = Tix.Message(top,
|
msg = tkinter.tix.Message(top,
|
||||||
relief=Tix.FLAT, width=200, anchor=Tix.N,
|
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.')
|
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['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.
|
scrollbars are shown only when needed.
|
||||||
Additional modifiers can be used to force a
|
Additional modifiers can be used to force a
|
||||||
scrollbar to be shown or hidden. For example,
|
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)
|
win.place(x=30, y=150, width=190, height=100)
|
||||||
|
|
||||||
rh = Tix.ResizeHandle(top, bg='black',
|
rh = tkinter.tix.ResizeHandle(top, bg='black',
|
||||||
relief=Tix.RAISED,
|
relief=tkinter.tix.RAISED,
|
||||||
handlesize=8, gridded=1, minwidth=50, minheight=30)
|
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)
|
top.propagate(0)
|
||||||
msg.pack(fill=Tix.X)
|
msg.pack(fill=tkinter.tix.X)
|
||||||
btn.pack(anchor=Tix.CENTER)
|
btn.pack(anchor=tkinter.tix.CENTER)
|
||||||
top.pack(expand=1, fill=Tix.BOTH)
|
top.pack(expand=1, fill=tkinter.tix.BOTH)
|
||||||
bot.pack(fill=Tix.BOTH)
|
bot.pack(fill=tkinter.tix.BOTH)
|
||||||
win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
|
win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
|
||||||
win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
|
win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
|
||||||
|
|
||||||
|
@ -612,8 +612,8 @@ def MkManager(nb, name):
|
||||||
w = nb.page(name)
|
w = nb.page(name)
|
||||||
options='label.padX 4'
|
options='label.padX 4'
|
||||||
|
|
||||||
pane = Tix.LabelFrame(w, label='Tix.PanedWindow', options=options)
|
pane = tkinter.tix.LabelFrame(w, label='Tix.PanedWindow', options=options)
|
||||||
note = Tix.LabelFrame(w, label='Tix.NoteBook', options=options)
|
note = tkinter.tix.LabelFrame(w, label='Tix.NoteBook', options=options)
|
||||||
|
|
||||||
MkPanedWindow(pane.frame)
|
MkPanedWindow(pane.frame)
|
||||||
MkNoteBook(note.frame)
|
MkNoteBook(note.frame)
|
||||||
|
@ -626,29 +626,29 @@ def MkPanedWindow(w):
|
||||||
the sizes of several panes. The panes can be arranged either vertically
|
the sizes of several panes. The panes can be arranged either vertically
|
||||||
or horizontally.
|
or horizontally.
|
||||||
"""
|
"""
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
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.')
|
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')
|
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)
|
p1 = pane.add('list', min=70, size=100)
|
||||||
p2 = pane.add('text', min=70)
|
p2 = pane.add('text', min=70)
|
||||||
list = Tix.ScrolledListBox(p1)
|
list = tkinter.tix.ScrolledListBox(p1)
|
||||||
text = Tix.ScrolledText(p2)
|
text = tkinter.tix.ScrolledText(p2)
|
||||||
|
|
||||||
list.listbox.insert(Tix.END, " 12324 Re: Tkinter is good for your health")
|
list.listbox.insert(tkinter.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(tkinter.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(tkinter.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(tkinter.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(tkinter.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(tkinter.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, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)")
|
||||||
|
|
||||||
text.text['bg'] = list.listbox['bg']
|
text.text['bg'] = list.listbox['bg']
|
||||||
text.text['wrap'] = 'none'
|
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
|
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
|
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
|
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
|
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.
|
together with a bitmap, at the same time, inside a TK button widget.
|
||||||
""")
|
""")
|
||||||
list.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=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)
|
msg.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH)
|
||||||
group.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH)
|
group.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH)
|
||||||
pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1)
|
pane.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
def MkNoteBook(w):
|
def MkNoteBook(w):
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N,
|
||||||
text='The NoteBook widget allows you to layout a complex interface into individual pages.')
|
text='The NoteBook widget allows you to layout a complex interface into individual pages.')
|
||||||
# prefix = Tix.OptionName(w)
|
# prefix = Tix.OptionName(w)
|
||||||
# if not prefix: prefix = ''
|
# if not prefix: prefix = ''
|
||||||
# w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8)
|
# 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('hard_disk', label="Hard Disk", underline=0)
|
||||||
nb.add('network', label="Network", underline=0)
|
nb.add('network', label="Network", underline=0)
|
||||||
|
|
||||||
# Frame for the buttons that are present on all pages
|
# Frame for the buttons that are present on all pages
|
||||||
common = Tix.Frame(nb.hard_disk)
|
common = tkinter.tix.Frame(nb.hard_disk)
|
||||||
common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y)
|
common.pack(side=tkinter.tix.RIGHT, padx=2, pady=2, fill=tkinter.tix.Y)
|
||||||
CreateCommonButtons(common)
|
CreateCommonButtons(common)
|
||||||
|
|
||||||
# Widgets belonging only to this page
|
# Widgets belonging only to this page
|
||||||
a = Tix.Control(nb.hard_disk, value=12, label='Access Time: ')
|
a = tkinter.tix.Control(nb.hard_disk, value=12, label='Access Time: ')
|
||||||
w = Tix.Control(nb.hard_disk, value=400, label='Write Throughput: ')
|
w = tkinter.tix.Control(nb.hard_disk, value=400, label='Write Throughput: ')
|
||||||
r = Tix.Control(nb.hard_disk, value=400, label='Read Throughput: ')
|
r = tkinter.tix.Control(nb.hard_disk, value=400, label='Read Throughput: ')
|
||||||
c = Tix.Control(nb.hard_disk, value=1021, label='Capacity: ')
|
c = tkinter.tix.Control(nb.hard_disk, value=1021, label='Capacity: ')
|
||||||
a.pack(side=Tix.TOP, padx=20, pady=2)
|
a.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
w.pack(side=Tix.TOP, padx=20, pady=2)
|
w.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
r.pack(side=Tix.TOP, padx=20, pady=2)
|
r.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
c.pack(side=Tix.TOP, padx=20, pady=2)
|
c.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
|
|
||||||
common = Tix.Frame(nb.network)
|
common = tkinter.tix.Frame(nb.network)
|
||||||
common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y)
|
common.pack(side=tkinter.tix.RIGHT, padx=2, pady=2, fill=tkinter.tix.Y)
|
||||||
CreateCommonButtons(common)
|
CreateCommonButtons(common)
|
||||||
|
|
||||||
a = Tix.Control(nb.network, value=12, label='Access Time: ')
|
a = tkinter.tix.Control(nb.network, value=12, label='Access Time: ')
|
||||||
w = Tix.Control(nb.network, value=400, label='Write Throughput: ')
|
w = tkinter.tix.Control(nb.network, value=400, label='Write Throughput: ')
|
||||||
r = Tix.Control(nb.network, value=400, label='Read Throughput: ')
|
r = tkinter.tix.Control(nb.network, value=400, label='Read Throughput: ')
|
||||||
c = Tix.Control(nb.network, value=1021, label='Capacity: ')
|
c = tkinter.tix.Control(nb.network, value=1021, label='Capacity: ')
|
||||||
u = Tix.Control(nb.network, value=10, label='Users: ')
|
u = tkinter.tix.Control(nb.network, value=10, label='Users: ')
|
||||||
a.pack(side=Tix.TOP, padx=20, pady=2)
|
a.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
w.pack(side=Tix.TOP, padx=20, pady=2)
|
w.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
r.pack(side=Tix.TOP, padx=20, pady=2)
|
r.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
c.pack(side=Tix.TOP, padx=20, pady=2)
|
c.pack(side=tkinter.tix.TOP, padx=20, pady=2)
|
||||||
u.pack(side=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)
|
msg.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH)
|
||||||
nb.pack(side=Tix.TOP, padx=5, pady=5, fill=Tix.BOTH, expand=1)
|
nb.pack(side=tkinter.tix.TOP, padx=5, pady=5, fill=tkinter.tix.BOTH, expand=1)
|
||||||
|
|
||||||
def CreateCommonButtons(f):
|
def CreateCommonButtons(f):
|
||||||
ok = Tix.Button(f, text='OK', width = 6)
|
ok = tkinter.tix.Button(f, text='OK', width = 6)
|
||||||
cancel = Tix.Button(f, text='Cancel', width = 6)
|
cancel = tkinter.tix.Button(f, text='Cancel', width = 6)
|
||||||
ok.pack(side=Tix.TOP, padx=2, pady=2)
|
ok.pack(side=tkinter.tix.TOP, padx=2, pady=2)
|
||||||
cancel.pack(side=Tix.TOP, padx=2, pady=2)
|
cancel.pack(side=tkinter.tix.TOP, padx=2, pady=2)
|
||||||
|
|
||||||
def MkDirList(nb, name):
|
def MkDirList(nb, name):
|
||||||
w = nb.page(name)
|
w = nb.page(name)
|
||||||
options = "label.padX 4"
|
options = "label.padX 4"
|
||||||
|
|
||||||
dir = Tix.LabelFrame(w, label='Tix.DirList', options=options)
|
dir = tkinter.tix.LabelFrame(w, label='Tix.DirList', options=options)
|
||||||
fsbox = Tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options)
|
fsbox = tkinter.tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options)
|
||||||
MkDirListWidget(dir.frame)
|
MkDirListWidget(dir.frame)
|
||||||
MkExFileWidget(fsbox.frame)
|
MkExFileWidget(fsbox.frame)
|
||||||
dir.form(top=0, left=0, right='%40', bottom=-1)
|
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
|
system directory and makes it easy for the user to choose and access
|
||||||
directories.
|
directories.
|
||||||
"""
|
"""
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
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.')
|
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')
|
dirlist = tkinter.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)
|
msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3)
|
||||||
dirlist.pack(side=Tix.TOP, padx=3, pady=3)
|
dirlist.pack(side=tkinter.tix.TOP, padx=3, pady=3)
|
||||||
|
|
||||||
def MkExFileWidget(w):
|
def MkExFileWidget(w):
|
||||||
"""The TixExFileSelectBox widget is more user friendly than the Motif
|
"""The TixExFileSelectBox widget is more user friendly than the Motif
|
||||||
style FileSelectBox. """
|
style FileSelectBox. """
|
||||||
msg = Tix.Message(w,
|
msg = tkinter.tix.Message(w,
|
||||||
relief=Tix.FLAT, width=240, anchor=Tix.N,
|
relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N,
|
||||||
text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
|
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
|
# There's a bug in the ComboBoxes - the scrolledlistbox is destroyed
|
||||||
box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED)
|
box = tkinter.tix.ExFileSelectBox(w, bd=2, relief=tkinter.tix.RAISED)
|
||||||
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)
|
||||||
box.pack(side=Tix.TOP, padx=3, pady=3)
|
box.pack(side=tkinter.tix.TOP, padx=3, pady=3)
|
||||||
|
|
||||||
###
|
###
|
||||||
### List of all the demos we want to show off
|
### List of all the demos we want to show off
|
||||||
|
@ -875,39 +875,39 @@ def MkSample(nb, name):
|
||||||
w = nb.page(name)
|
w = nb.page(name)
|
||||||
options = "label.padX 4"
|
options = "label.padX 4"
|
||||||
|
|
||||||
pane = Tix.PanedWindow(w, orientation='horizontal')
|
pane = tkinter.tix.PanedWindow(w, orientation='horizontal')
|
||||||
pane.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH)
|
pane.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH)
|
||||||
f1 = pane.add('list', expand='1')
|
f1 = pane.add('list', expand='1')
|
||||||
f2 = pane.add('text', expand='5')
|
f2 = pane.add('text', expand='5')
|
||||||
f1['relief'] = 'flat'
|
f1['relief'] = 'flat'
|
||||||
f2['relief'] = 'flat'
|
f2['relief'] = 'flat'
|
||||||
|
|
||||||
lab = Tix.LabelFrame(f1, label='Select a sample program:')
|
lab = tkinter.tix.LabelFrame(f1, label='Select a sample program:')
|
||||||
lab.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5)
|
lab.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5)
|
||||||
lab1 = Tix.LabelFrame(f2, label='Source:')
|
lab1 = tkinter.tix.LabelFrame(f2, label='Source:')
|
||||||
lab1.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5)
|
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 = tkinter.tix.Tree(lab.frame, options='hlist.width 20')
|
||||||
slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5)
|
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')
|
font = root.tk.eval('tix option get fixed_font')
|
||||||
stext.text.config(font=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')
|
run = tkinter.tix.Button(frame, text='Run ...', name='run')
|
||||||
view = Tix.Button(frame, text='View Source ...', name='view')
|
view = tkinter.tix.Button(frame, text='View Source ...', name='view')
|
||||||
run.pack(side=Tix.LEFT, expand=0, fill=Tix.NONE)
|
run.pack(side=tkinter.tix.LEFT, expand=0, fill=tkinter.tix.NONE)
|
||||||
view.pack(side=Tix.LEFT, expand=0, fill=Tix.NONE)
|
view.pack(side=tkinter.tix.LEFT, expand=0, fill=tkinter.tix.NONE)
|
||||||
|
|
||||||
stext.text['bg'] = slb.hlist['bg']
|
stext.text['bg'] = slb.hlist['bg']
|
||||||
stext.text['state'] = 'disabled'
|
stext.text['state'] = 'disabled'
|
||||||
stext.text['wrap'] = 'none'
|
stext.text['wrap'] = 'none'
|
||||||
stext.text['width'] = 80
|
stext.text['width'] = 80
|
||||||
|
|
||||||
frame.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X, padx=7)
|
frame.pack(side=tkinter.tix.BOTTOM, expand=0, fill=tkinter.tix.X, padx=7)
|
||||||
stext.pack(side=Tix.TOP, expand=0, fill=Tix.BOTH, padx=7)
|
stext.pack(side=tkinter.tix.TOP, expand=0, fill=tkinter.tix.BOTH, padx=7)
|
||||||
|
|
||||||
slb.hlist['separator'] = '.'
|
slb.hlist['separator'] = '.'
|
||||||
slb.hlist['width'] = 25
|
slb.hlist['width'] = 25
|
||||||
|
@ -922,13 +922,13 @@ def MkSample(nb, name):
|
||||||
|
|
||||||
for type in ['widget', 'image']:
|
for type in ['widget', 'image']:
|
||||||
if type != 'widget':
|
if type != 'widget':
|
||||||
x = Tix.Frame(slb.hlist, bd=2, height=2, width=150,
|
x = tkinter.tix.Frame(slb.hlist, bd=2, height=2, width=150,
|
||||||
relief=Tix.SUNKEN, bg=slb.hlist['bg'])
|
relief=tkinter.tix.SUNKEN, bg=slb.hlist['bg'])
|
||||||
slb.hlist.add_child(itemtype=Tix.WINDOW, window=x, state='disabled')
|
slb.hlist.add_child(itemtype=tkinter.tix.WINDOW, window=x, state='disabled')
|
||||||
x = slb.hlist.add_child(itemtype=Tix.TEXT, state='disabled',
|
x = slb.hlist.add_child(itemtype=tkinter.tix.TEXT, state='disabled',
|
||||||
text=comments[type])
|
text=comments[type])
|
||||||
for key in stypes[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)
|
text=key)
|
||||||
slb.hlist.selection_clear()
|
slb.hlist.selection_clear()
|
||||||
|
|
||||||
|
@ -955,12 +955,12 @@ def Sample_Action(w, slb, stext, run, view, action):
|
||||||
|
|
||||||
if action == 'run':
|
if action == 'run':
|
||||||
exec('import ' + prog)
|
exec('import ' + prog)
|
||||||
w = Tix.Toplevel()
|
w = tkinter.tix.Toplevel()
|
||||||
w.title(title)
|
w.title(title)
|
||||||
rtn = eval(prog + '.RunSample')
|
rtn = eval(prog + '.RunSample')
|
||||||
rtn(w)
|
rtn(w)
|
||||||
elif action == 'view':
|
elif action == 'view':
|
||||||
w = Tix.Toplevel()
|
w = tkinter.tix.Toplevel()
|
||||||
w.title('Source view: ' + title)
|
w.title('Source view: ' + title)
|
||||||
LoadFile(w, demo.dir + '/samples/' + prog + '.py')
|
LoadFile(w, demo.dir + '/samples/' + prog + '.py')
|
||||||
elif action == 'browse':
|
elif action == 'browse':
|
||||||
|
@ -968,8 +968,8 @@ def Sample_Action(w, slb, stext, run, view, action):
|
||||||
|
|
||||||
def LoadFile(w, fname):
|
def LoadFile(w, fname):
|
||||||
global root
|
global root
|
||||||
b = Tix.Button(w, text='Close', command=w.destroy)
|
b = tkinter.tix.Button(w, text='Close', command=w.destroy)
|
||||||
t = Tix.ScrolledText(w)
|
t = tkinter.tix.ScrolledText(w)
|
||||||
# b.form(left=0, bottom=0, padx=4, pady=4)
|
# b.form(left=0, bottom=0, padx=4, pady=4)
|
||||||
# t.form(left=0, bottom=b, right='-0', top=0)
|
# t.form(left=0, bottom=b, right='-0', top=0)
|
||||||
t.pack()
|
t.pack()
|
||||||
|
@ -985,18 +985,18 @@ def LoadFile(w, fname):
|
||||||
def ReadFile(w, fname):
|
def ReadFile(w, fname):
|
||||||
old_state = w['state']
|
old_state = w['state']
|
||||||
w['state'] = 'normal'
|
w['state'] = 'normal'
|
||||||
w.delete('0.0', Tix.END)
|
w.delete('0.0', tkinter.tix.END)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open(fname)
|
f = open(fname)
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
for s in lines:
|
for s in lines:
|
||||||
w.insert(Tix.END, s)
|
w.insert(tkinter.tix.END, s)
|
||||||
f.close()
|
f.close()
|
||||||
finally:
|
finally:
|
||||||
# w.see('1.0')
|
# w.see('1.0')
|
||||||
w['state'] = old_state
|
w['state'] = old_state
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = Tix.Tk()
|
root = tkinter.tix.Tk()
|
||||||
RunMain(root)
|
RunMain(root)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# -- totally static, though different between PackDialog and WidgetDialog
|
# -- totally static, though different between PackDialog and WidgetDialog
|
||||||
# (but even that could be unified)
|
# (but even that could be unified)
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Widget to display a man page
|
# Widget to display a man page
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from Tkinter import _tkinter
|
from tkinter import _tkinter
|
||||||
from ScrolledText import ScrolledText
|
from tkinter.scrolledtext import ScrolledText
|
||||||
|
|
||||||
# XXX These fonts may have to be changed to match your system
|
# XXX These fonts may have to be changed to match your system
|
||||||
BOLDFONT = '*-Courier-Bold-R-Normal-*-120-*'
|
BOLDFONT = '*-Courier-Bold-R-Normal-*-120-*'
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
import string
|
import string
|
||||||
from types import *
|
from types import *
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from ScrolledText import ScrolledText
|
from tkinter.scrolledtext import ScrolledText
|
||||||
|
|
||||||
class MimeViewer:
|
class MimeViewer:
|
||||||
def __init__(self, parent, title, msg):
|
def __init__(self, parent, title, msg):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from ScrolledText import ScrolledText
|
from tkinter.scrolledtext import ScrolledText
|
||||||
from Dialog import Dialog
|
from tkinter.dialog import Dialog
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
BUFSIZE = 512
|
BUFSIZE = 512
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Brownian motion -- an example of a multi-threaded Tkinter program.
|
# Brownian motion -- an example of a multi-threaded Tkinter program.
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import random
|
import random
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Brownian motion -- an example of a NON multi-threaded Tkinter program ;)
|
# Brownian motion -- an example of a NON multi-threaded Tkinter program ;)
|
||||||
# By Michele Simoniato, inspired by brownian.py
|
# By Michele Simoniato, inspired by brownian.py
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from Canvas import Oval, Group, CanvasText
|
from Canvas import Oval, Group, CanvasText
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# optional bitmap, and any number of buttons.
|
# optional bitmap, and any number of buttons.
|
||||||
# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.2-3, pp. 269-270.
|
# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.2-3, pp. 269-270.
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# /usr/include/X11/bitmaps for samples); it is displayed as the
|
# /usr/include/X11/bitmaps for samples); it is displayed as the
|
||||||
# background of the animation. Default is no bitmap.
|
# background of the animation. Default is no bitmap.
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# background of the animation. Default is no bitmap.
|
# background of the animation. Default is no bitmap.
|
||||||
|
|
||||||
# This uses Steen Lumholt's Tk interface
|
# 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
|
# Basic Towers-of-Hanoi algorithm: move n pieces from a to b, using c
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Display hello, world in a button; clicking it quits the program
|
# Display hello, world in a button; clicking it quits the program
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
root = Tk()
|
root = Tk()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Draw on top of an image"""
|
"""Draw on top of an image"""
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# Tkinter interface to Linux `kill' command.
|
# Tkinter interface to Linux `kill' command.
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from string import splitfields
|
from string import splitfields
|
||||||
from string import split
|
from string import split
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
def listtree(master, app):
|
def listtree(master, app):
|
||||||
list = Listbox(master, name='list')
|
list = Listbox(master, name='list')
|
||||||
|
|
|
@ -9,7 +9,7 @@ import getopt
|
||||||
import string
|
import string
|
||||||
import mhlib
|
import mhlib
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
from dialog import dialog
|
from dialog import dialog
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
"""Play with the new Tk 8.0 toplevel menu option."""
|
"""Play with the new Tk 8.0 toplevel menu option."""
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
class App:
|
class App:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# option menu sample (Fredrik Lundh, September 1997)
|
# option menu sample (Fredrik Lundh, September 1997)
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
root = Tk()
|
root = Tk()
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ options like other shapes or colors...
|
||||||
davem@magnet.com
|
davem@magnet.com
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
"""paint.py: not exactly a paint program.. just a smooth line drawing demo."""
|
"""paint.py: not exactly a paint program.. just a smooth line drawing demo."""
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
# XXX This should be written in a more Python-like style!!!
|
# XXX This should be written in a more Python-like style!!!
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# 1. Create basic application structure: menu bar on top of
|
# 1. Create basic application structure: menu bar on top of
|
||||||
|
|
|
@ -25,7 +25,7 @@ know!
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from Canvas import Rectangle, CanvasText, Group, Window
|
from Canvas import Rectangle, CanvasText, Group, Window
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ stand-alone application.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from Canvas import Line, Rectangle
|
from Canvas import Line, Rectangle
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,7 @@ def colnum2name(n):
|
||||||
s = chr(m+ord('A')) + s
|
s = chr(m+ord('A')) + s
|
||||||
return s
|
return s
|
||||||
|
|
||||||
import Tkinter as Tk
|
import tkinter as Tk
|
||||||
|
|
||||||
class SheetGUI:
|
class SheetGUI:
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Tkinter interface to SYSV `ps' and `kill' commands.
|
# Tkinter interface to SYSV `ps' and `kill' commands.
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
if TkVersion < 4.0:
|
if TkVersion < 4.0:
|
||||||
raise ImportError("This version of svkill requires Tk 4.0 or later")
|
raise ImportError("This version of svkill requires Tk 4.0 or later")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Show how to do switchable panels.
|
# Show how to do switchable panels.
|
||||||
|
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
class App:
|
class App:
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import sys
|
||||||
import os
|
import os
|
||||||
import string
|
import string
|
||||||
import re
|
import re
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from ManPage import ManPage
|
from ManPage import ManPage
|
||||||
|
|
||||||
MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann']
|
MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann']
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# note that there is no explicit call to start Tk.
|
# note that there is no explicit call to start Tk.
|
||||||
# Tkinter is smart enough to start the system if it's not already going.
|
# Tkinter is smart enough to start the system if it's not already going.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This program shows how to use the "after" function to make animation.
|
# This program shows how to use the "after" function to make animation.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this is the same as simple-demo-1.py, but uses
|
# this is the same as simple-demo-1.py, but uses
|
||||||
# subclassing.
|
# subclassing.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import string
|
import string
|
||||||
|
|
||||||
# This program shows how to use a simple type-in box
|
# This program shows how to use a simple type-in box
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this program creates a canvas and puts a single polygon on the canvas
|
# this program creates a canvas and puts a single polygon on the canvas
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this is the same as simple-demo-1.py, but uses
|
# this is the same as simple-demo-1.py, but uses
|
||||||
# subclassing.
|
# subclassing.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this file demonstrates a more sophisticated movement --
|
# this file demonstrates a more sophisticated movement --
|
||||||
# move dots or create new ones if you click outside the dots
|
# move dots or create new ones if you click outside the dots
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this file demonstrates the movement of a single canvas item under mouse control
|
# this file demonstrates the movement of a single canvas item under mouse control
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# allows moving dots with multiple selection.
|
# allows moving dots with multiple selection.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
|
|
||||||
class Test(Frame):
|
class Test(Frame):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this file demonstrates the creation of widgets as part of a canvas object
|
# this file demonstrates the creation of widgets as part of a canvas object
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This example program creates a scroling canvas, and demonstrates
|
# This example program creates a scroling canvas, and demonstrates
|
||||||
# how to tie scrollbars and canvses together. The mechanism
|
# how to tie scrollbars and canvses together. The mechanism
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
from Dialog import Dialog
|
from tkinter.dialog import Dialog
|
||||||
|
|
||||||
# this shows how to create a new window with a button in it
|
# this shows how to create a new window with a button in it
|
||||||
# that can create new windows
|
# that can create new windows
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import string
|
import string
|
||||||
|
|
||||||
# This program shows how to use a simple type-in box
|
# This program shows how to use a simple type-in box
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
import string
|
import string
|
||||||
|
|
||||||
# This program shows how to make a typein box shadow a program variable.
|
# This program shows how to make a typein box shadow a program variable.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This file shows how to trap the killing of a window
|
# This file shows how to trap the killing of a window
|
||||||
# when the user uses window manager menus (typ. upper left hand corner
|
# when the user uses window manager menus (typ. upper left hand corner
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# some vocabulary to keep from getting confused. This terminology
|
# some vocabulary to keep from getting confused. This terminology
|
||||||
# is something I cooked up for this file, but follows the man pages
|
# is something I cooked up for this file, but follows the man pages
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# some vocabulary to keep from getting confused. This terminology
|
# some vocabulary to keep from getting confused. This terminology
|
||||||
# is something I cooked up for this file, but follows the man pages
|
# is something I cooked up for this file, but follows the man pages
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
|
|
||||||
class Test(Frame):
|
class Test(Frame):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
|
|
||||||
class Test(Frame):
|
class Test(Frame):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This is a program that tests the placer geom manager in conjunction with
|
# 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
|
# the packer. The background (green) is packed, while the widget inside is placed
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
|
|
||||||
class Test(Frame):
|
class Test(Frame):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This is a program that tests the placer geom manager
|
# This is a program that tests the placer geom manager
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this file demonstrates the creation of widgets as part of a canvas object
|
# this file demonstrates the creation of widgets as part of a canvas object
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This is a demo program that shows how to
|
# This is a demo program that shows how to
|
||||||
# create radio buttons and how to get other widgets to
|
# create radio buttons and how to get other widgets to
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
class Test(Frame):
|
class Test(Frame):
|
||||||
def printit(self):
|
def printit(self):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
class Test(Frame):
|
class Test(Frame):
|
||||||
def printit(self):
|
def printit(self):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# shows how to make a slider, set and get its value under program control
|
# shows how to make a slider, set and get its value under program control
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# This is a program that makes a simple two button application
|
# This is a program that makes a simple two button application
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# The way to think about this is that each radio button menu
|
# The way to think about this is that each radio button menu
|
||||||
# controls a different variable -- clicking on one of the
|
# controls a different variable -- clicking on one of the
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this shows how to create a new window with a button in it
|
# this shows how to create a new window with a button in it
|
||||||
# that can create new windows
|
# that can create new windows
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
# this shows how to spawn off new windows at a button press
|
# this shows how to spawn off new windows at a button press
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from Tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
##sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
|
##sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue