Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d6d63f54
Commit
d6d63f54
authored
Jan 04, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a lot of Tkinter imports
parent
6cb2bddb
Changes
76
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
76 changed files
with
542 additions
and
542 deletions
+542
-542
Demo/tix/grid.py
Demo/tix/grid.py
+1
-1
Demo/tix/samples/Balloon.py
Demo/tix/samples/Balloon.py
+9
-9
Demo/tix/samples/BtnBox.py
Demo/tix/samples/BtnBox.py
+7
-7
Demo/tix/samples/CmpImg.py
Demo/tix/samples/CmpImg.py
+14
-14
Demo/tix/samples/ComboBox.py
Demo/tix/samples/ComboBox.py
+29
-29
Demo/tix/samples/Control.py
Demo/tix/samples/Control.py
+15
-15
Demo/tix/samples/DirList.py
Demo/tix/samples/DirList.py
+10
-10
Demo/tix/samples/DirTree.py
Demo/tix/samples/DirTree.py
+8
-8
Demo/tix/samples/NoteBook.py
Demo/tix/samples/NoteBook.py
+36
-36
Demo/tix/samples/OptMenu.py
Demo/tix/samples/OptMenu.py
+12
-12
Demo/tix/samples/PanedWin.py
Demo/tix/samples/PanedWin.py
+20
-20
Demo/tix/samples/PopMenu.py
Demo/tix/samples/PopMenu.py
+11
-11
Demo/tix/samples/SHList1.py
Demo/tix/samples/SHList1.py
+13
-13
Demo/tix/samples/SHList2.py
Demo/tix/samples/SHList2.py
+21
-21
Demo/tix/samples/Tree.py
Demo/tix/samples/Tree.py
+10
-10
Demo/tix/tixwidgets.py
Demo/tix/tixwidgets.py
+260
-260
Demo/tkinter/guido/AttrDialog.py
Demo/tkinter/guido/AttrDialog.py
+1
-1
Demo/tkinter/guido/ManPage.py
Demo/tkinter/guido/ManPage.py
+3
-3
Demo/tkinter/guido/MimeViewer.py
Demo/tkinter/guido/MimeViewer.py
+2
-2
Demo/tkinter/guido/ShellWindow.py
Demo/tkinter/guido/ShellWindow.py
+3
-3
Demo/tkinter/guido/brownian.py
Demo/tkinter/guido/brownian.py
+1
-1
Demo/tkinter/guido/brownian2.py
Demo/tkinter/guido/brownian2.py
+1
-1
Demo/tkinter/guido/canvasevents.py
Demo/tkinter/guido/canvasevents.py
+1
-1
Demo/tkinter/guido/dialog.py
Demo/tkinter/guido/dialog.py
+1
-1
Demo/tkinter/guido/electrons.py
Demo/tkinter/guido/electrons.py
+1
-1
Demo/tkinter/guido/hanoi.py
Demo/tkinter/guido/hanoi.py
+1
-1
Demo/tkinter/guido/hello.py
Demo/tkinter/guido/hello.py
+1
-1
Demo/tkinter/guido/imagedraw.py
Demo/tkinter/guido/imagedraw.py
+1
-1
Demo/tkinter/guido/imageview.py
Demo/tkinter/guido/imageview.py
+1
-1
Demo/tkinter/guido/kill.py
Demo/tkinter/guido/kill.py
+1
-1
Demo/tkinter/guido/listtree.py
Demo/tkinter/guido/listtree.py
+1
-1
Demo/tkinter/guido/mbox.py
Demo/tkinter/guido/mbox.py
+1
-1
Demo/tkinter/guido/newmenubardemo.py
Demo/tkinter/guido/newmenubardemo.py
+1
-1
Demo/tkinter/guido/optionmenu.py
Demo/tkinter/guido/optionmenu.py
+1
-1
Demo/tkinter/guido/paint.py
Demo/tkinter/guido/paint.py
+1
-1
Demo/tkinter/guido/rmt.py
Demo/tkinter/guido/rmt.py
+1
-1
Demo/tkinter/guido/solitaire.py
Demo/tkinter/guido/solitaire.py
+1
-1
Demo/tkinter/guido/sortvisu.py
Demo/tkinter/guido/sortvisu.py
+1
-1
Demo/tkinter/guido/ss1.py
Demo/tkinter/guido/ss1.py
+1
-1
Demo/tkinter/guido/svkill.py
Demo/tkinter/guido/svkill.py
+1
-1
Demo/tkinter/guido/switch.py
Demo/tkinter/guido/switch.py
+1
-1
Demo/tkinter/guido/tkman.py
Demo/tkinter/guido/tkman.py
+1
-1
Demo/tkinter/matt/00-HELLO-WORLD.py
Demo/tkinter/matt/00-HELLO-WORLD.py
+1
-1
Demo/tkinter/matt/animation-simple.py
Demo/tkinter/matt/animation-simple.py
+1
-1
Demo/tkinter/matt/animation-w-velocity-ctrl.py
Demo/tkinter/matt/animation-w-velocity-ctrl.py
+1
-1
Demo/tkinter/matt/bind-w-mult-calls-p-type.py
Demo/tkinter/matt/bind-w-mult-calls-p-type.py
+1
-1
Demo/tkinter/matt/canvas-demo-simple.py
Demo/tkinter/matt/canvas-demo-simple.py
+1
-1
Demo/tkinter/matt/canvas-gridding.py
Demo/tkinter/matt/canvas-gridding.py
+1
-1
Demo/tkinter/matt/canvas-moving-or-creating.py
Demo/tkinter/matt/canvas-moving-or-creating.py
+1
-1
Demo/tkinter/matt/canvas-moving-w-mouse.py
Demo/tkinter/matt/canvas-moving-w-mouse.py
+1
-1
Demo/tkinter/matt/canvas-mult-item-sel.py
Demo/tkinter/matt/canvas-mult-item-sel.py
+1
-1
Demo/tkinter/matt/canvas-reading-tag-info.py
Demo/tkinter/matt/canvas-reading-tag-info.py
+1
-1
Demo/tkinter/matt/canvas-w-widget-draw-el.py
Demo/tkinter/matt/canvas-w-widget-draw-el.py
+1
-1
Demo/tkinter/matt/canvas-with-scrollbars.py
Demo/tkinter/matt/canvas-with-scrollbars.py
+1
-1
Demo/tkinter/matt/dialog-box.py
Demo/tkinter/matt/dialog-box.py
+2
-2
Demo/tkinter/matt/entry-simple.py
Demo/tkinter/matt/entry-simple.py
+1
-1
Demo/tkinter/matt/entry-with-shared-variable.py
Demo/tkinter/matt/entry-with-shared-variable.py
+1
-1
Demo/tkinter/matt/killing-window-w-wm.py
Demo/tkinter/matt/killing-window-w-wm.py
+1
-1
Demo/tkinter/matt/menu-all-types-of-entries.py
Demo/tkinter/matt/menu-all-types-of-entries.py
+1
-1
Demo/tkinter/matt/menu-simple.py
Demo/tkinter/matt/menu-simple.py
+1
-1
Demo/tkinter/matt/not-what-you-might-think-1.py
Demo/tkinter/matt/not-what-you-might-think-1.py
+1
-1
Demo/tkinter/matt/not-what-you-might-think-2.py
Demo/tkinter/matt/not-what-you-might-think-2.py
+1
-1
Demo/tkinter/matt/packer-and-placer-together.py
Demo/tkinter/matt/packer-and-placer-together.py
+1
-1
Demo/tkinter/matt/packer-simple.py
Demo/tkinter/matt/packer-simple.py
+1
-1
Demo/tkinter/matt/placer-simple.py
Demo/tkinter/matt/placer-simple.py
+1
-1
Demo/tkinter/matt/pong-demo-1.py
Demo/tkinter/matt/pong-demo-1.py
+1
-1
Demo/tkinter/matt/printing-coords-of-items.py
Demo/tkinter/matt/printing-coords-of-items.py
+1
-1
Demo/tkinter/matt/radiobutton-simple.py
Demo/tkinter/matt/radiobutton-simple.py
+1
-1
Demo/tkinter/matt/rubber-band-box-demo-1.py
Demo/tkinter/matt/rubber-band-box-demo-1.py
+1
-1
Demo/tkinter/matt/rubber-line-demo-1.py
Demo/tkinter/matt/rubber-line-demo-1.py
+1
-1
Demo/tkinter/matt/slider-demo-1.py
Demo/tkinter/matt/slider-demo-1.py
+1
-1
Demo/tkinter/matt/subclass-existing-widgets.py
Demo/tkinter/matt/subclass-existing-widgets.py
+1
-1
Demo/tkinter/matt/two-radio-groups.py
Demo/tkinter/matt/two-radio-groups.py
+1
-1
Demo/tkinter/matt/window-creation-more.py
Demo/tkinter/matt/window-creation-more.py
+1
-1
Demo/tkinter/matt/window-creation-simple.py
Demo/tkinter/matt/window-creation-simple.py
+1
-1
Demo/tkinter/matt/window-creation-w-location.py
Demo/tkinter/matt/window-creation-w-location.py
+1
-1
No files found.
Demo/tix/grid.py
View file @
d6d63f54
###
###
import
T
ix
as
tk
import
tkinter.t
ix
as
tk
from
pprint
import
pprint
from
pprint
import
pprint
r
=
tk
.
Tk
()
r
=
tk
.
Tk
()
...
...
Demo/tix/samples/Balloon.py
View file @
d6d63f54
...
@@ -15,7 +15,7 @@
...
@@ -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
T
ix
import
tkinter.t
ix
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -32,20 +32,20 @@ class DemoBalloon:
...
@@ -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
=
T
ix
.
SUNKEN
,
bd
=
1
)
status
=
tkinter
.
tix
.
Label
(
w
,
width
=
40
,
relief
=
tkinter
.
t
ix
.
SUNKEN
,
bd
=
1
)
status
.
pack
(
side
=
Tix
.
BOTTOM
,
fill
=
T
ix
.
Y
,
padx
=
2
,
pady
=
1
)
status
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
Y
,
padx
=
2
,
pady
=
1
)
# Create two mysterious widgets that need balloon help
# Create two mysterious widgets that need balloon help
button1
=
T
ix
.
Button
(
w
,
text
=
'Something Unexpected'
,
button1
=
tkinter
.
t
ix
.
Button
(
w
,
text
=
'Something Unexpected'
,
command
=
self
.
quitcmd
)
command
=
self
.
quitcmd
)
button2
=
T
ix
.
Button
(
w
,
text
=
'Something Else Unexpected'
)
button2
=
tkinter
.
t
ix
.
Button
(
w
,
text
=
'Something Else Unexpected'
)
button2
[
'command'
]
=
lambda
w
=
button2
:
w
.
destroy
()
button2
[
'command'
]
=
lambda
w
=
button2
:
w
.
destroy
()
button1
.
pack
(
side
=
T
ix
.
TOP
,
expand
=
1
)
button1
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
expand
=
1
)
button2
.
pack
(
side
=
T
ix
.
TOP
,
expand
=
1
)
button2
.
pack
(
side
=
tkinter
.
t
ix
.
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
=
T
ix
.
Balloon
(
w
,
statusbar
=
status
)
b
=
tkinter
.
t
ix
.
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:
...
@@ -64,5 +64,5 @@ class DemoBalloon:
self
.
root
.
destroy
()
self
.
root
.
destroy
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
Demo/tix/samples/BtnBox.py
View file @
d6d63f54
...
@@ -15,13 +15,13 @@
...
@@ -15,13 +15,13 @@
# for example.
# for example.
#
#
import
T
ix
import
tkinter.t
ix
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
=
T
ix
.
RAISED
,
top
=
tkinter
.
tix
.
Label
(
w
,
padx
=
20
,
pady
=
10
,
bd
=
1
,
relief
=
tkinter
.
t
ix
.
RAISED
,
anchor
=
T
ix
.
CENTER
,
text
=
'This dialog box is
\
n
a demonstration of the
\
n
tixButtonBox widget'
)
anchor
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/samples/CmpImg.py
View file @
d6d63f54
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
# buttons
# buttons
#
#
import
T
ix
import
tkinter.t
ix
network_pixmap
=
"""/* XPM */
network_pixmap
=
"""/* XPM */
static char * netw_xpm[] = {
static char * netw_xpm[] = {
...
@@ -144,15 +144,15 @@ static unsigned char drivea_bits[] = {
...
@@ -144,15 +144,15 @@ static unsigned char drivea_bits[] = {
"""
"""
def
RunSample
(
w
):
def
RunSample
(
w
):
w
.
img0
=
T
ix
.
Image
(
'pixmap'
,
data
=
network_pixmap
)
w
.
img0
=
tkinter
.
t
ix
.
Image
(
'pixmap'
,
data
=
network_pixmap
)
if
not
w
.
img0
:
if
not
w
.
img0
:
w
.
img0
=
T
ix
.
Image
(
'bitmap'
,
data
=
network_bitmap
)
w
.
img0
=
tkinter
.
t
ix
.
Image
(
'bitmap'
,
data
=
network_bitmap
)
w
.
img1
=
T
ix
.
Image
(
'pixmap'
,
data
=
hard_disk_pixmap
)
w
.
img1
=
tkinter
.
t
ix
.
Image
(
'pixmap'
,
data
=
hard_disk_pixmap
)
if
not
w
.
img0
:
if
not
w
.
img0
:
w
.
img1
=
T
ix
.
Image
(
'bitmap'
,
data
=
hard_disk_bitmap
)
w
.
img1
=
tkinter
.
t
ix
.
Image
(
'bitmap'
,
data
=
hard_disk_bitmap
)
hdd
=
T
ix
.
Button
(
w
,
padx
=
4
,
pady
=
1
,
width
=
120
)
hdd
=
tkinter
.
t
ix
.
Button
(
w
,
padx
=
4
,
pady
=
1
,
width
=
120
)
net
=
T
ix
.
Button
(
w
,
padx
=
4
,
pady
=
1
,
width
=
120
)
net
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
Image
(
'compound'
,
window
=
hdd
)
w
.
hdd_img
=
tkinter
.
t
ix
.
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):
...
@@ -172,7 +172,7 @@ def RunSample(w):
hdd
[
'image'
]
=
w
.
hdd_img
hdd
[
'image'
]
=
w
.
hdd_img
# Next button
# Next button
w
.
net_img
=
T
ix
.
Image
(
'compound'
,
window
=
net
)
w
.
net_img
=
tkinter
.
t
ix
.
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):
...
@@ -183,14 +183,14 @@ def RunSample(w):
#
#
net
[
'image'
]
=
w
.
net_img
net
[
'image'
]
=
w
.
net_img
close
=
T
ix
.
Button
(
w
,
pady
=
1
,
text
=
'Close'
,
close
=
tkinter
.
t
ix
.
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
=
T
ix
.
Y
,
expand
=
1
)
hdd
.
pack
(
side
=
tkinter
.
tix
.
LEFT
,
padx
=
10
,
pady
=
10
,
fill
=
tkinter
.
t
ix
.
Y
,
expand
=
1
)
net
.
pack
(
side
=
Tix
.
LEFT
,
padx
=
10
,
pady
=
10
,
fill
=
T
ix
.
Y
,
expand
=
1
)
net
.
pack
(
side
=
tkinter
.
tix
.
LEFT
,
padx
=
10
,
pady
=
10
,
fill
=
tkinter
.
t
ix
.
Y
,
expand
=
1
)
close
.
pack
(
side
=
Tix
.
LEFT
,
padx
=
10
,
pady
=
10
,
fill
=
T
ix
.
Y
,
expand
=
1
)
close
.
pack
(
side
=
tkinter
.
tix
.
LEFT
,
padx
=
10
,
pady
=
10
,
fill
=
tkinter
.
t
ix
.
Y
,
expand
=
1
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/samples/ComboBox.py
View file @
d6d63f54
...
@@ -13,15 +13,15 @@
...
@@ -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
T
ix
import
tkinter.t
ix
def
RunSample
(
w
):
def
RunSample
(
w
):
global
demo_month
,
demo_year
global
demo_month
,
demo_year
top
=
Tix
.
Frame
(
w
,
bd
=
1
,
relief
=
T
ix
.
RAISED
)
top
=
tkinter
.
tix
.
Frame
(
w
,
bd
=
1
,
relief
=
tkinter
.
t
ix
.
RAISED
)
demo_month
=
T
ix
.
StringVar
()
demo_month
=
tkinter
.
t
ix
.
StringVar
()
demo_year
=
T
ix
.
StringVar
()
demo_year
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
ComboBox
(
top
,
label
=
"Month: "
,
dropdown
=
1
,
a
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
ComboBox
(
top
,
label
=
"Year: "
,
dropdown
=
0
,
b
=
tkinter
.
t
ix
.
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
=
T
ix
.
W
)
a
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
)
b
.
pack
(
side
=
Tix
.
TOP
,
anchor
=
T
ix
.
W
)
b
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
)
a
.
insert
(
T
ix
.
END
,
'January'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'January'
)
a
.
insert
(
T
ix
.
END
,
'February'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'February'
)
a
.
insert
(
T
ix
.
END
,
'March'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'March'
)
a
.
insert
(
T
ix
.
END
,
'April'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'April'
)
a
.
insert
(
T
ix
.
END
,
'May'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'May'
)
a
.
insert
(
T
ix
.
END
,
'June'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'June'
)
a
.
insert
(
T
ix
.
END
,
'July'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'July'
)
a
.
insert
(
T
ix
.
END
,
'August'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'August'
)
a
.
insert
(
T
ix
.
END
,
'September'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'September'
)
a
.
insert
(
T
ix
.
END
,
'October'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'October'
)
a
.
insert
(
T
ix
.
END
,
'November'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'November'
)
a
.
insert
(
T
ix
.
END
,
'December'
)
a
.
insert
(
tkinter
.
t
ix
.
END
,
'December'
)
b
.
insert
(
T
ix
.
END
,
'1992'
)
b
.
insert
(
tkinter
.
t
ix
.
END
,
'1992'
)
b
.
insert
(
T
ix
.
END
,
'1993'
)
b
.
insert
(
tkinter
.
t
ix
.
END
,
'1993'
)
b
.
insert
(
T
ix
.
END
,
'1994'
)
b
.
insert
(
tkinter
.
t
ix
.
END
,
'1994'
)
b
.
insert
(
T
ix
.
END
,
'1995'
)
b
.
insert
(
tkinter
.
t
ix
.
END
,
'1995'
)
b
.
insert
(
T
ix
.
END
,
'1996'
)
b
.
insert
(
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
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):
...
@@ -97,6 +97,6 @@ def ok_command(w):
w
.
destroy
()
w
.
destroy
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/samples/Control.py
View file @
d6d63f54
...
@@ -18,7 +18,7 @@
...
@@ -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
T
ix
import
tkinter.t
ix
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -34,14 +34,14 @@ class DemoControl:
...
@@ -34,14 +34,14 @@ class DemoControl:
global
demo_maker
,
demo_thrust
,
demo_num_engines
global
demo_maker
,
demo_thrust
,
demo_num_engines
demo_maker
=
T
ix
.
StringVar
()
demo_maker
=
tkinter
.
t
ix
.
StringVar
()
demo_thrust
=
T
ix
.
DoubleVar
()
demo_thrust
=
tkinter
.
t
ix
.
DoubleVar
()
demo_num_engines
=
T
ix
.
IntVar
()
demo_num_engines
=
tkinter
.
t
ix
.
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
=
T
ix
.
RAISED
)
top
=
tkinter
.
tix
.
Frame
(
w
,
bd
=
1
,
relief
=
tkinter
.
t
ix
.
RAISED
)
# $w.top.a allows only integer values
# $w.top.a allows only integer values
#
#
...
@@ -49,16 +49,16 @@ class DemoControl:
...
@@ -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
=
T
ix
.
Control
(
top
,
label
=
'Number of Engines: '
,
integer
=
1
,
a
=
tkinter
.
t
ix
.
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
=
T
ix
.
Control
(
top
,
label
=
'Thrust: '
,
integer
=
0
,
b
=
tkinter
.
t
ix
.
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
=
T
ix
.
Control
(
top
,
label
=
'Engine Maker: '
,
value
=
'P&W'
,
c
=
tkinter
.
t
ix
.
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:
...
@@ -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
=
T
ix
.
W
)
a
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
)
b
.
pack
(
side
=
Tix
.
TOP
,
anchor
=
T
ix
.
W
)
b
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
)
c
.
pack
(
side
=
Tix
.
TOP
,
anchor
=
T
ix
.
W
)
c
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
)
box
=
Tix
.
ButtonBox
(
w
,
orientation
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
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):
...
@@ -118,5 +118,5 @@ def validate_maker(w):
return
maker_list
[
i
]
return
maker_list
[
i
]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
Demo/tix/samples/DirList.py
View file @
d6d63f54
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
# installation directory for an application.
# installation directory for an application.
#
#
import
T
ix
,
os
,
copy
import
tkinter.t
ix
,
os
,
copy
from
Tk
constants
import
*
from
tkinter.
constants
import
*
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -40,25 +40,25 @@ class DemoDirList:
...
@@ -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
=
T
ix
.
Frame
(
w
,
relief
=
RAISED
,
bd
=
1
)
top
=
tkinter
.
t
ix
.
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
=
T
ix
.
DirList
(
top
)
top
.
dir
=
tkinter
.
t
ix
.
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
=
T
ix
.
Button
(
top
,
text
=
" >> "
,
pady
=
0
)
top
.
btn
=
tkinter
.
t
ix
.
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
=
T
ix
.
LabelEntry
(
top
,
label
=
"Installation Directory:"
,
top
.
ent
=
tkinter
.
t
ix
.
LabelEntry
(
top
,
label
=
"Installation Directory:"
,
labelside
=
'top'
,
labelside
=
'top'
,
options
=
'''
options
=
'''
entry.width 40
entry.width 40
...
@@ -85,7 +85,7 @@ class DemoDirList:
...
@@ -85,7 +85,7 @@ class DemoDirList:
# Use a ButtonBox to hold the buttons.
# Use a ButtonBox to hold the buttons.
#
#
box
=
T
ix
.
ButtonBox
(
w
,
orientation
=
'horizontal'
)
box
=
tkinter
.
t
ix
.
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:
...
@@ -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
tk
MessageB
ox
,
traceback
import
tk
inter.messageb
ox
,
traceback
try
:
try
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
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
=
tk
MessageB
ox
.
showerror
(
'Tix Demo Error'
,
text
)
d
=
tk
inter
.
messageb
ox
.
showerror
(
'Tix Demo Error'
,
text
)
Demo/tix/samples/DirTree.py
View file @
d6d63f54
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
# installation directory for an application.
# installation directory for an application.
#
#
import
T
ix
,
os
,
copy
import
tkinter.t
ix
,
os
,
copy
from
Tk
constants
import
*
from
tkinter.
constants
import
*
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -40,25 +40,25 @@ class DemoDirTree:
...
@@ -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
=
T
ix
.
Frame
(
w
,
relief
=
RAISED
,
bd
=
1
)
top
=
tkinter
.
t
ix
.
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
=
T
ix
.
DirTree
(
top
)
top
.
dir
=
tkinter
.
t
ix
.
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
=
T
ix
.
Button
(
top
,
text
=
" >> "
,
pady
=
0
)
top
.
btn
=
tkinter
.
t
ix
.
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
=
T
ix
.
LabelEntry
(
top
,
label
=
"Installation Directory:"
,
top
.
ent
=
tkinter
.
t
ix
.
LabelEntry
(
top
,
label
=
"Installation Directory:"
,
labelside
=
'top'
,
labelside
=
'top'
,
options
=
'''
options
=
'''
entry.width 40
entry.width 40
...
@@ -79,7 +79,7 @@ class DemoDirTree:
...
@@ -79,7 +79,7 @@ class DemoDirTree:
# Use a ButtonBox to hold the buttons.
# Use a ButtonBox to hold the buttons.
#
#
box
=
T
ix
.
ButtonBox
(
w
,
orientation
=
'horizontal'
)
box
=
tkinter
.
t
ix
.
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:
...
@@ -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
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
Demo/tix/samples/NoteBook.py
View file @
d6d63f54
...
@@ -13,7 +13,7 @@
...
@@ -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
T
ix
import
tkinter.t
ix
def
RunSample
(
w
):
def
RunSample
(
w
):
global
root
global
root
...
@@ -21,20 +21,20 @@ def RunSample(w):
...
@@ -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
=
T
ix
.
OptionName
(
w
)
prefix
=
tkinter
.
t
ix
.
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'
,
T
ix
.
E
)
w
.
option_add
(
prefix
+
'*TixControl*label.anchor'
,
tkinter
.
t
ix
.
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
=
T
ix
.
NoteBook
(
w
,
name
=
'nb'
,
ipadx
=
6
,
ipady
=
6
)
nb
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
TOP
)
nb
.
pack
(
expand
=
1
,
fill
=
tkinter
.
tix
.
BOTH
,
padx
=
5
,
pady
=
5
,
side
=
tkinter
.
t
ix
.
TOP
)
#----------------------------------------
#----------------------------------------
# Create the first page
# Create the first page
...
@@ -54,21 +54,21 @@ def RunSample(w):
...
@@ -54,21 +54,21 @@ def RunSample(w):
# other widgets
# other widgets
#
#
tab
=
nb
.
hard_disk
tab
=
nb
.
hard_disk
f
=
T
ix
.
Frame
(
tab
)
f
=
tkinter
.
t
ix
.
Frame
(
tab
)
common
=
T
ix
.
Frame
(
tab
)
common
=
tkinter
.
t
ix
.
Frame
(
tab
)
f
.
pack
(
side
=
Tix
.
LEFT
,
padx
=
2
,
pady
=
2
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
f
.
pack
(
side
=
tkinter
.
tix
.
LEFT
,
padx
=
2
,
pady
=
2
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
common
.
pack
(
side
=
Tix
.
RIGHT
,
padx
=
2
,
fill
=
T
ix
.
Y
)
common
.
pack
(
side
=
tkinter
.
tix
.
RIGHT
,
padx
=
2
,
fill
=
tkinter
.
t
ix
.
Y
)
a
=
T
ix
.
Control
(
f
,
value
=
12
,
label
=
'Access time: '
)
a
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
12
,
label
=
'Access time: '
)
w
=
T
ix
.
Control
(
f
,
value
=
400
,
label
=
'Write Throughput: '
)
w
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
400
,
label
=
'Write Throughput: '
)
r
=
T
ix
.
Control
(
f
,
value
=
400
,
label
=
'Read Throughput: '
)
r
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
400
,
label
=
'Read Throughput: '
)
c
=
T
ix
.
Control
(
f
,
value
=
1021
,
label
=
'Capacity: '
)
c
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
1021
,
label
=
'Capacity: '
)
a
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
a
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
w
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
w
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
r
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
r
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
c
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
c
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
# Create the common buttons
# Create the common buttons
createCommonButtons
(
common
)
createCommonButtons
(
common
)
...
@@ -79,23 +79,23 @@ def RunSample(w):
...
@@ -79,23 +79,23 @@ def RunSample(w):
tab
=
nb
.
network
tab
=
nb
.
network
f
=
T
ix
.
Frame
(
tab
)
f
=
tkinter
.
t
ix
.
Frame
(
tab
)
common
=
T
ix
.
Frame
(
tab
)
common
=
tkinter
.
t
ix
.
Frame
(
tab
)
f
.
pack
(
side
=
Tix
.
LEFT
,
padx
=
2
,
pady
=
2
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
f
.
pack
(
side
=
tkinter
.
tix
.
LEFT
,
padx
=
2
,
pady
=
2
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
common
.
pack
(
side
=
Tix
.
RIGHT
,
padx
=
2
,
fill
=
T
ix
.
Y
)
common
.
pack
(
side
=
tkinter
.
tix
.
RIGHT
,
padx
=
2
,
fill
=
tkinter
.
t
ix
.
Y
)
a
=
T
ix
.
Control
(
f
,
value
=
12
,
label
=
'Access time: '
)
a
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
12
,
label
=
'Access time: '
)
w
=
T
ix
.
Control
(
f
,
value
=
400
,
label
=
'Write Throughput: '
)
w
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
400
,
label
=
'Write Throughput: '
)
r
=
T
ix
.
Control
(
f
,
value
=
400
,
label
=
'Read Throughput: '
)
r
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
400
,
label
=
'Read Throughput: '
)
c
=
T
ix
.
Control
(
f
,
value
=
1021
,
label
=
'Capacity: '
)
c
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
1021
,
label
=
'Capacity: '
)
u
=
T
ix
.
Control
(
f
,
value
=
10
,
label
=
'Users: '
)
u
=
tkinter
.
t
ix
.
Control
(
f
,
value
=
10
,
label
=
'Users: '
)
a
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
a
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
w
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
w
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
r
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
r
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
c
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
c
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
u
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
u
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
20
,
pady
=
2
)
createCommonButtons
(
common
)
createCommonButtons
(
common
)
...
@@ -104,16 +104,16 @@ def doDestroy():
...
@@ -104,16 +104,16 @@ def doDestroy():
root
.
destroy
()
root
.
destroy
()
def
createCommonButtons
(
master
):
def
createCommonButtons
(
master
):
ok
=
T
ix
.
Button
(
master
,
name
=
'ok'
,
text
=
'OK'
,
width
=
6
,
ok
=
tkinter
.
t
ix
.
Button
(
master
,
name
=
'ok'
,
text
=
'OK'
,
width
=
6
,
command
=
doDestroy
)
command
=
doDestroy
)
cancel
=
T
ix
.
Button
(
master
,
name
=
'cancel'
,
cancel
=
tkinter
.
t
ix
.
Button
(
master
,
name
=
'cancel'
,
text
=
'Cancel'
,
width
=
6
,
text
=
'Cancel'
,
width
=
6
,
command
=
doDestroy
)
command
=
doDestroy
)
ok
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
2
,
pady
=
2
)
ok
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
2
,
pady
=
2
)
cancel
.
pack
(
side
=
T
ix
.
TOP
,
padx
=
2
,
pady
=
2
)
cancel
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
2
,
pady
=
2
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/samples/OptMenu.py
View file @
d6d63f54
...
@@ -13,7 +13,7 @@
...
@@ -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
T
ix
import
tkinter.t
ix
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',
...
@@ -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
=
T
ix
.
StringVar
()
demo_opt_from
=
tkinter
.
t
ix
.
StringVar
()
demo_opt_to
=
T
ix
.
StringVar
()
demo_opt_to
=
tkinter
.
t
ix
.
StringVar
()
top
=
Tix
.
Frame
(
w
,
bd
=
1
,
relief
=
T
ix
.
RAISED
)
top
=
tkinter
.
tix
.
Frame
(
w
,
bd
=
1
,
relief
=
tkinter
.
t
ix
.
RAISED
)
from_file
=
T
ix
.
OptionMenu
(
top
,
label
=
"From File Format : "
,
from_file
=
tkinter
.
t
ix
.
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
=
T
ix
.
OptionMenu
(
top
,
label
=
"To File Format : "
,
to_file
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
W
,
pady
=
3
,
padx
=
6
)
from_file
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
,
pady
=
3
,
padx
=
6
)
to_file
.
pack
(
side
=
Tix
.
TOP
,
anchor
=
T
ix
.
W
,
pady
=
3
,
padx
=
6
)
to_file
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
anchor
=
tkinter
.
t
ix
.
W
,
pady
=
3
,
padx
=
6
)
box
=
Tix
.
ButtonBox
(
w
,
orientation
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
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
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/samples/PanedWin.py
View file @
d6d63f54
...
@@ -15,7 +15,7 @@
...
@@ -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
T
ix
import
tkinter.t
ix
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -32,30 +32,30 @@ class DemoPanedwin:
...
@@ -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
=
T
ix
.
LabelEntry
(
w
,
label
=
'Newsgroup:'
,
options
=
'entry.width 25'
)
group
=
tkinter
.
t
ix
.
LabelEntry
(
w
,
label
=
'Newsgroup:'
,
options
=
'entry.width 25'
)
group
.
entry
.
insert
(
0
,
'comp.lang.python'
)
group
.
entry
.
insert
(
0
,
'comp.lang.python'
)
pane
=
T
ix
.
PanedWindow
(
w
,
orientation
=
'vertical'
)
pane
=
tkinter
.
t
ix
.
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
=
T
ix
.
ScrolledListBox
(
p1
)
list
=
tkinter
.
t
ix
.
ScrolledListBox
(
p1
)
list
.
listbox
[
'width'
]
=
80
list
.
listbox
[
'width'
]
=
80
list
.
listbox
[
'height'
]
=
5
list
.
listbox
[
'height'
]
=
5
text
=
T
ix
.
ScrolledText
(
p2
)
text
=
tkinter
.
t
ix
.
ScrolledText
(
p2
)
text
.
text
[
'width'
]
=
80
text
.
text
[
'width'
]
=
80
text
.
text
[
'height'
]
=
20
text
.
text
[
'height'
]
=
20
list
.
listbox
.
insert
(
T
ix
.
END
,
" 12324 Re: Tkinter is good for your health"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
END
,
" 12324 Re: Tkinter is good for your health"
)
list
.
listbox
.
insert
(
T
ix
.
END
,
"+ 12325 Re: Tkinter is good for your health"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
END
,
"+ 12325 Re: Tkinter is good for your health"
)
list
.
listbox
.
insert
(
T
ix
.
END
,
"+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
END
,
"+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
T
ix
.
END
,
" 12327 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
END
,
" 12327 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
T
ix
.
END
,
"+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
END
,
"+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
T
ix
.
END
,
" 12329 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
END
,
" 12329 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
T
ix
.
END
,
"+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)"
)
list
.
listbox
.
insert
(
tkinter
.
t
ix
.
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
(
T
ix
.
END
,
"""
text
.
text
.
insert
(
tkinter
.
t
ix
.
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:
...
@@ -70,18 +70,18 @@ class DemoPanedwin:
"""
)
"""
)
text
.
text
[
'state'
]
=
'disabled'
text
.
text
[
'state'
]
=
'disabled'
list
.
pack
(
expand
=
1
,
fill
=
T
ix
.
BOTH
,
padx
=
4
,
pady
=
6
)
list
.
pack
(
expand
=
1
,
fill
=
tkinter
.
t
ix
.
BOTH
,
padx
=
4
,
pady
=
6
)
text
.
pack
(
expand
=
1
,
fill
=
T
ix
.
BOTH
,
padx
=
4
,
pady
=
6
)
text
.
pack
(
expand
=
1
,
fill
=
tkinter
.
t
ix
.
BOTH
,
padx
=
4
,
pady
=
6
)
group
.
pack
(
side
=
Tix
.
TOP
,
padx
=
3
,
pady
=
3
,
fill
=
T
ix
.
BOTH
)
group
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
padx
=
3
,
pady
=
3
,
fill
=
tkinter
.
t
ix
.
BOTH
)
pane
.
pack
(
side
=
Tix
.
TOP
,
padx
=
3
,
pady
=
3
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
pane
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
padx
=
3
,
pady
=
3
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
box
=
Tix
.
ButtonBox
(
w
,
orientation
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
def
quitcmd
(
self
):
def
quitcmd
(
self
):
self
.
exit
=
0
self
.
exit
=
0
...
@@ -94,5 +94,5 @@ class DemoPanedwin:
...
@@ -94,5 +94,5 @@ class DemoPanedwin:
self
.
root
.
destroy
()
self
.
root
.
destroy
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
Demo/tix/samples/PopMenu.py
View file @
d6d63f54
...
@@ -12,18 +12,18 @@
...
@@ -12,18 +12,18 @@
# This file demonstrates the use of the tixPopupMenu widget.
# This file demonstrates the use of the tixPopupMenu widget.
#
#
import
T
ix
import
tkinter.t
ix
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
=
T
ix
.
RAISED
,
bd
=
1
)
top
=
tkinter
.
tix
.
Frame
(
w
,
relief
=
tkinter
.
t
ix
.
RAISED
,
bd
=
1
)
but
=
T
ix
.
Button
(
top
,
text
=
'Press the right mouse button over this button or its surrounding area'
)
but
=
tkinter
.
t
ix
.
Button
(
top
,
text
=
'Press the right mouse button over this button or its surrounding area'
)
but
.
pack
(
expand
=
1
,
fill
=
T
ix
.
BOTH
,
padx
=
50
,
pady
=
50
)
but
.
pack
(
expand
=
1
,
fill
=
tkinter
.
t
ix
.
BOTH
,
padx
=
50
,
pady
=
50
)
p
=
T
ix
.
PopupMenu
(
top
,
title
=
'Popup Test'
)
p
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
Menu
(
p
.
menu
)
m1
=
tkinter
.
t
ix
.
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
=
T
ix
.
TOP
,
padx
=
40
,
pady
=
50
)
but
.
pack
(
side
=
tkinter
.
t
ix
.
TOP
,
padx
=
40
,
pady
=
50
)
box
=
Tix
.
ButtonBox
(
w
,
orientation
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/samples/SHList1.py
View file @
d6d63f54
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# This file demonstrates the use of the tixScrolledHList widget.
# This file demonstrates the use of the tixScrolledHList widget.
#
#
import
T
ix
import
tkinter.t
ix
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -33,13 +33,13 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
RAISED
,
bd
=
1
)
top
=
tkinter
.
tix
.
Frame
(
w
,
relief
=
tkinter
.
t
ix
.
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
=
T
ix
.
ScrolledHList
(
top
)
top
.
a
=
tkinter
.
t
ix
.
ScrolledHList
(
top
)
top
.
a
.
pack
(
expand
=
1
,
fill
=
Tix
.
BOTH
,
padx
=
10
,
pady
=
10
,
side
=
T
ix
.
TOP
)
top
.
a
.
pack
(
expand
=
1
,
fill
=
tkinter
.
tix
.
BOTH
,
padx
=
10
,
pady
=
10
,
side
=
tkinter
.
t
ix
.
TOP
)
# This is our little relational database
# This is our little relational database
#
#
...
@@ -68,13 +68,13 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
Frame
(
hlist
,
name
=
'sep%d'
%
count
,
height
=
2
,
width
=
150
,
f
=
tkinter
.
t
ix
.
Frame
(
hlist
,
name
=
'sep%d'
%
count
,
height
=
2
,
width
=
150
,
bd
=
2
,
relief
=
T
ix
.
SUNKEN
)
bd
=
2
,
relief
=
tkinter
.
t
ix
.
SUNKEN
)
hlist
.
add_child
(
itemtype
=
T
ix
.
WINDOW
,
hlist
.
add_child
(
itemtype
=
tkinter
.
t
ix
.
WINDOW
,
window
=
f
,
state
=
T
ix
.
DISABLED
)
window
=
f
,
state
=
tkinter
.
t
ix
.
DISABLED
)
hlist
.
add
(
boss
,
itemtype
=
T
ix
.
TEXT
,
text
=
name
)
hlist
.
add
(
boss
,
itemtype
=
tkinter
.
t
ix
.
TEXT
,
text
=
name
)
count
=
count
+
1
count
=
count
+
1
...
@@ -99,15 +99,15 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
top
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
def
okcmd
(
self
):
def
okcmd
(
self
):
self
.
quitcmd
()
self
.
quitcmd
()
...
@@ -127,5 +127,5 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
Demo/tix/samples/SHList2.py
View file @
d6d63f54
...
@@ -16,7 +16,7 @@
...
@@ -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
T
ix
import
tkinter.t
ix
TCL_ALL_EVENTS
=
0
TCL_ALL_EVENTS
=
0
...
@@ -36,13 +36,13 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
RAISED
,
bd
=
1
)
top
=
tkinter
.
tix
.
Frame
(
w
,
relief
=
tkinter
.
t
ix
.
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
=
T
ix
.
ScrolledHList
(
top
,
options
=
'hlist.columns 3 hlist.header 1'
)
top
.
a
=
tkinter
.
t
ix
.
ScrolledHList
(
top
,
options
=
'hlist.columns 3 hlist.header 1'
)
top
.
a
.
pack
(
expand
=
1
,
fill
=
Tix
.
BOTH
,
padx
=
10
,
pady
=
10
,
side
=
T
ix
.
TOP
)
top
.
a
.
pack
(
expand
=
1
,
fill
=
tkinter
.
tix
.
BOTH
,
padx
=
10
,
pady
=
10
,
side
=
tkinter
.
t
ix
.
TOP
)
hlist
=
top
.
a
.
hlist
hlist
=
top
.
a
.
hlist
...
@@ -55,12 +55,12 @@ class DemoSHList:
...
@@ -55,12 +55,12 @@ class DemoSHList:
# First some styles for the headers
# First some styles for the headers
style
=
{}
style
=
{}
style
[
'header'
]
=
Tix
.
DisplayStyle
(
T
ix
.
TEXT
,
refwindow
=
hlist
,
style
[
'header'
]
=
tkinter
.
tix
.
DisplayStyle
(
tkinter
.
t
ix
.
TEXT
,
refwindow
=
hlist
,
anchor
=
T
ix
.
CENTER
,
padx
=
8
,
pady
=
2
,
font
=
boldfont
)
anchor
=
tkinter
.
t
ix
.
CENTER
,
padx
=
8
,
pady
=
2
,
font
=
boldfont
)
hlist
.
header_create
(
0
,
itemtype
=
T
ix
.
TEXT
,
text
=
'Name'
,
hlist
.
header_create
(
0
,
itemtype
=
tkinter
.
t
ix
.
TEXT
,
text
=
'Name'
,
style
=
style
[
'header'
])
style
=
style
[
'header'
])
hlist
.
header_create
(
1
,
itemtype
=
T
ix
.
TEXT
,
text
=
'Position'
,
hlist
.
header_create
(
1
,
itemtype
=
tkinter
.
t
ix
.
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:
...
@@ -90,13 +90,13 @@ class DemoSHList:
(
'chuck'
,
'jeff'
,
'Chuck McLean'
,
'Cleaner'
)
(
'chuck'
,
'jeff'
,
'Chuck McLean'
,
'Cleaner'
)
]
]
style
[
'mgr_name'
]
=
Tix
.
DisplayStyle
(
T
ix
.
TEXT
,
refwindow
=
hlist
)
style
[
'mgr_name'
]
=
tkinter
.
tix
.
DisplayStyle
(
tkinter
.
t
ix
.
TEXT
,
refwindow
=
hlist
)
style
[
'mgr_posn'
]
=
Tix
.
DisplayStyle
(
T
ix
.
TEXT
,
padx
=
8
,
refwindow
=
hlist
)
style
[
'mgr_posn'
]
=
tkinter
.
tix
.
DisplayStyle
(
tkinter
.
t
ix
.
TEXT
,
padx
=
8
,
refwindow
=
hlist
)
style
[
'empl_name'
]
=
Tix
.
DisplayStyle
(
T
ix
.
TEXT
,
refwindow
=
hlist
)
style
[
'empl_name'
]
=
tkinter
.
tix
.
DisplayStyle
(
tkinter
.
t
ix
.
TEXT
,
refwindow
=
hlist
)
style
[
'empl_posn'
]
=
Tix
.
DisplayStyle
(
T
ix
.
TEXT
,
padx
=
8
,
refwindow
=
hlist
)
style
[
'empl_posn'
]
=
tkinter
.
tix
.
DisplayStyle
(
tkinter
.
t
ix
.
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:
...
@@ -105,9 +105,9 @@ class DemoSHList:
# Create the boss
# Create the boss
#
#
hlist
.
add
(
'.'
,
itemtype
=
T
ix
.
TEXT
,
text
=
boss
[
1
],
hlist
.
add
(
'.'
,
itemtype
=
tkinter
.
t
ix
.
TEXT
,
text
=
boss
[
1
],
style
=
style
[
'mgr_name'
])
style
=
style
[
'mgr_name'
])
hlist
.
item_create
(
'.'
,
1
,
itemtype
=
T
ix
.
TEXT
,
text
=
boss
[
2
],
hlist
.
item_create
(
'.'
,
1
,
itemtype
=
tkinter
.
t
ix
.
TEXT
,
text
=
boss
[
2
],
style
=
style
[
'mgr_posn'
])
style
=
style
[
'mgr_posn'
])
# Create the managers
# Create the managers
...
@@ -115,9 +115,9 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
TEXT
,
text
=
name
,
hlist
.
add
(
e
,
itemtype
=
tkinter
.
t
ix
.
TEXT
,
text
=
name
,
style
=
style
[
'mgr_name'
])
style
=
style
[
'mgr_name'
])
hlist
.
item_create
(
e
,
1
,
itemtype
=
T
ix
.
TEXT
,
text
=
posn
,
hlist
.
item_create
(
e
,
1
,
itemtype
=
tkinter
.
t
ix
.
TEXT
,
text
=
posn
,
style
=
style
[
'mgr_posn'
])
style
=
style
[
'mgr_posn'
])
...
@@ -130,21 +130,21 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
TEXT
,
hlist
.
item_create
(
entrypath
,
1
,
itemtype
=
tkinter
.
t
ix
.
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
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
top
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
BOTH
,
expand
=
1
)
def
okcmd
(
self
):
def
okcmd
(
self
):
self
.
quitcmd
()
self
.
quitcmd
()
...
@@ -164,5 +164,5 @@ class DemoSHList:
...
@@ -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
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
Demo/tix/samples/Tree.py
View file @
d6d63f54
...
@@ -14,30 +14,30 @@
...
@@ -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
T
ix
,
os
import
tkinter.t
ix
,
os
def
RunSample
(
w
):
def
RunSample
(
w
):
top
=
Tix
.
Frame
(
w
,
relief
=
T
ix
.
RAISED
,
bd
=
1
)
top
=
tkinter
.
tix
.
Frame
(
w
,
relief
=
tkinter
.
t
ix
.
RAISED
,
bd
=
1
)
tree
=
T
ix
.
Tree
(
top
,
options
=
'separator "/"'
)
tree
=
tkinter
.
t
ix
.
Tree
(
top
,
options
=
'separator "/"'
)
tree
.
pack
(
expand
=
1
,
fill
=
Tix
.
BOTH
,
padx
=
10
,
pady
=
10
,
side
=
T
ix
.
LEFT
)
tree
.
pack
(
expand
=
1
,
fill
=
tkinter
.
tix
.
BOTH
,
padx
=
10
,
pady
=
10
,
side
=
tkinter
.
t
ix
.
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
=
T
ix
.
HORIZONTAL
)
box
=
tkinter
.
tix
.
ButtonBox
(
w
,
orientation
=
tkinter
.
t
ix
.
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
=
T
ix
.
X
)
box
.
pack
(
side
=
tkinter
.
tix
.
BOTTOM
,
fill
=
tkinter
.
t
ix
.
X
)
top
.
pack
(
side
=
Tix
.
TOP
,
fill
=
T
ix
.
BOTH
,
expand
=
1
)
top
.
pack
(
side
=
tkinter
.
tix
.
TOP
,
fill
=
tkinter
.
t
ix
.
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
=
T
ix
.
IMAGETEXT
,
text
=
text
,
tree
.
hlist
.
add
(
dir
,
itemtype
=
tkinter
.
t
ix
.
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):
...
@@ -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
=
T
ix
.
IMAGETEXT
,
text
=
file
,
tree
.
hlist
.
add
(
dir
+
'/'
+
file
,
itemtype
=
tkinter
.
t
ix
.
IMAGETEXT
,
text
=
file
,
image
=
tree
.
tk
.
call
(
'tix'
,
'getimage'
,
'file'
))
image
=
tree
.
tk
.
call
(
'tix'
,
'getimage'
,
'file'
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
root
=
T
ix
.
Tk
()
root
=
tkinter
.
t
ix
.
Tk
()
RunSample
(
root
)
RunSample
(
root
)
root
.
mainloop
()
root
.
mainloop
()
Demo/tix/tixwidgets.py
View file @
d6d63f54
This diff is collapsed.
Click to expand it.
Demo/tkinter/guido/AttrDialog.py
View file @
d6d63f54
...
@@ -12,7 +12,7 @@
...
@@ -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
T
kinter
import
*
from
t
kinter
import
*
class
Option
:
class
Option
:
...
...
Demo/tkinter/guido/ManPage.py
View file @
d6d63f54
# Widget to display a man page
# Widget to display a man page
import
re
import
re
from
T
kinter
import
*
from
t
kinter
import
*
from
T
kinter
import
_tkinter
from
t
kinter
import
_tkinter
from
ScrolledT
ext
import
ScrolledText
from
tkinter.scrolledt
ext
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-*'
...
...
Demo/tkinter/guido/MimeViewer.py
View file @
d6d63f54
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
import
string
import
string
from
types
import
*
from
types
import
*
from
T
kinter
import
*
from
t
kinter
import
*
from
ScrolledT
ext
import
ScrolledText
from
tkinter.scrolledt
ext
import
ScrolledText
class
MimeViewer
:
class
MimeViewer
:
def
__init__
(
self
,
parent
,
title
,
msg
):
def
__init__
(
self
,
parent
,
title
,
msg
):
...
...
Demo/tkinter/guido/ShellWindow.py
View file @
d6d63f54
import
os
import
os
import
sys
import
sys
import
string
import
string
from
T
kinter
import
*
from
t
kinter
import
*
from
ScrolledT
ext
import
ScrolledText
from
tkinter.scrolledt
ext
import
ScrolledText
from
D
ialog
import
Dialog
from
tkinter.d
ialog
import
Dialog
import
signal
import
signal
BUFSIZE
=
512
BUFSIZE
=
512
...
...
Demo/tkinter/guido/brownian.py
View file @
d6d63f54
# Brownian motion -- an example of a multi-threaded Tkinter program.
# Brownian motion -- an example of a multi-threaded Tkinter program.
from
T
kinter
import
*
from
t
kinter
import
*
import
random
import
random
import
threading
import
threading
import
time
import
time
...
...
Demo/tkinter/guido/brownian2.py
View file @
d6d63f54
# 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
T
kinter
import
*
from
t
kinter
import
*
import
random
import
random
import
sys
import
sys
...
...
Demo/tkinter/guido/canvasevents.py
View file @
d6d63f54
#! /usr/bin/env python
#! /usr/bin/env python
from
T
kinter
import
*
from
t
kinter
import
*
from
Canvas
import
Oval
,
Group
,
CanvasText
from
Canvas
import
Oval
,
Group
,
CanvasText
...
...
Demo/tkinter/guido/dialog.py
View file @
d6d63f54
...
@@ -4,7 +4,7 @@
...
@@ -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
T
kinter
import
*
from
t
kinter
import
*
import
sys
import
sys
...
...
Demo/tkinter/guido/electrons.py
View file @
d6d63f54
...
@@ -11,7 +11,7 @@
...
@@ -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
T
kinter
import
*
from
t
kinter
import
*
import
random
import
random
...
...
Demo/tkinter/guido/hanoi.py
View file @
d6d63f54
...
@@ -10,7 +10,7 @@
...
@@ -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
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/guido/hello.py
View file @
d6d63f54
# 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
T
kinter
import
*
from
t
kinter
import
*
def
main
():
def
main
():
root
=
Tk
()
root
=
Tk
()
...
...
Demo/tkinter/guido/imagedraw.py
View file @
d6d63f54
"""Draw on top of an image"""
"""Draw on top of an image"""
from
T
kinter
import
*
from
t
kinter
import
*
import
sys
import
sys
def
main
():
def
main
():
...
...
Demo/tkinter/guido/imageview.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
import
sys
import
sys
def
main
():
def
main
():
...
...
Demo/tkinter/guido/kill.py
View file @
d6d63f54
#! /usr/bin/env python
#! /usr/bin/env python
# Tkinter interface to Linux `kill' command.
# Tkinter interface to Linux `kill' command.
from
T
kinter
import
*
from
t
kinter
import
*
from
string
import
splitfields
from
string
import
splitfields
from
string
import
split
from
string
import
split
import
subprocess
import
subprocess
...
...
Demo/tkinter/guido/listtree.py
View file @
d6d63f54
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
sys
import
sys
import
string
import
string
from
T
kinter
import
*
from
t
kinter
import
*
def
listtree
(
master
,
app
):
def
listtree
(
master
,
app
):
list
=
Listbox
(
master
,
name
=
'list'
)
list
=
Listbox
(
master
,
name
=
'list'
)
...
...
Demo/tkinter/guido/mbox.py
View file @
d6d63f54
...
@@ -9,7 +9,7 @@ import getopt
...
@@ -9,7 +9,7 @@ import getopt
import
string
import
string
import
mhlib
import
mhlib
from
T
kinter
import
*
from
t
kinter
import
*
from
dialog
import
dialog
from
dialog
import
dialog
...
...
Demo/tkinter/guido/newmenubardemo.py
View file @
d6d63f54
...
@@ -2,7 +2,7 @@
...
@@ -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
T
kinter
import
*
from
t
kinter
import
*
class
App
:
class
App
:
...
...
Demo/tkinter/guido/optionmenu.py
View file @
d6d63f54
# option menu sample (Fredrik Lundh, September 1997)
# option menu sample (Fredrik Lundh, September 1997)
from
T
kinter
import
*
from
t
kinter
import
*
root
=
Tk
()
root
=
Tk
()
...
...
Demo/tkinter/guido/paint.py
View file @
d6d63f54
...
@@ -20,7 +20,7 @@ options like other shapes or colors...
...
@@ -20,7 +20,7 @@ options like other shapes or colors...
davem@magnet.com
davem@magnet.com
"""
"""
from
T
kinter
import
*
from
t
kinter
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."""
...
...
Demo/tkinter/guido/rmt.py
View file @
d6d63f54
...
@@ -11,7 +11,7 @@
...
@@ -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
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/guido/solitaire.py
View file @
d6d63f54
...
@@ -25,7 +25,7 @@ know!
...
@@ -25,7 +25,7 @@ know!
import
math
import
math
import
random
import
random
from
T
kinter
import
*
from
t
kinter
import
*
from
Canvas
import
Rectangle
,
CanvasText
,
Group
,
Window
from
Canvas
import
Rectangle
,
CanvasText
,
Group
,
Window
...
...
Demo/tkinter/guido/sortvisu.py
View file @
d6d63f54
...
@@ -19,7 +19,7 @@ stand-alone application.
...
@@ -19,7 +19,7 @@ stand-alone application.
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
from
Canvas
import
Line
,
Rectangle
from
Canvas
import
Line
,
Rectangle
import
random
import
random
...
...
Demo/tkinter/guido/ss1.py
View file @
d6d63f54
...
@@ -485,7 +485,7 @@ def colnum2name(n):
...
@@ -485,7 +485,7 @@ def colnum2name(n):
s
=
chr
(
m
+
ord
(
'A'
))
+
s
s
=
chr
(
m
+
ord
(
'A'
))
+
s
return
s
return
s
import
T
kinter
as
Tk
import
t
kinter
as
Tk
class
SheetGUI
:
class
SheetGUI
:
...
...
Demo/tkinter/guido/svkill.py
View file @
d6d63f54
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# Tkinter interface to SYSV `ps' and `kill' commands.
# Tkinter interface to SYSV `ps' and `kill' commands.
from
T
kinter
import
*
from
t
kinter
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"
)
...
...
Demo/tkinter/guido/switch.py
View file @
d6d63f54
# Show how to do switchable panels.
# Show how to do switchable panels.
from
T
kinter
import
*
from
t
kinter
import
*
class
App
:
class
App
:
...
...
Demo/tkinter/guido/tkman.py
View file @
d6d63f54
...
@@ -6,7 +6,7 @@ import sys
...
@@ -6,7 +6,7 @@ import sys
import
os
import
os
import
string
import
string
import
re
import
re
from
T
kinter
import
*
from
t
kinter
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'
]
...
...
Demo/tkinter/matt/00-HELLO-WORLD.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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.
...
...
Demo/tkinter/matt/animation-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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.
...
...
Demo/tkinter/matt/animation-w-velocity-ctrl.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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.
...
...
Demo/tkinter/matt/bind-w-mult-calls-p-type.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/canvas-demo-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/canvas-gridding.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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.
...
...
Demo/tkinter/matt/canvas-moving-or-creating.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/canvas-moving-w-mouse.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/canvas-mult-item-sel.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
# allows moving dots with multiple selection.
# allows moving dots with multiple selection.
...
...
Demo/tkinter/matt/canvas-reading-tag-info.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
class
Test
(
Frame
):
class
Test
(
Frame
):
...
...
Demo/tkinter/matt/canvas-w-widget-draw-el.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/canvas-with-scrollbars.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/dialog-box.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
from
D
ialog
import
Dialog
from
tkinter.d
ialog
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
...
...
Demo/tkinter/matt/entry-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/entry-with-shared-variable.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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.
...
...
Demo/tkinter/matt/killing-window-w-wm.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/menu-all-types-of-entries.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/menu-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/not-what-you-might-think-1.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
class
Test
(
Frame
):
class
Test
(
Frame
):
...
...
Demo/tkinter/matt/not-what-you-might-think-2.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
class
Test
(
Frame
):
class
Test
(
Frame
):
...
...
Demo/tkinter/matt/packer-and-placer-together.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/packer-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
class
Test
(
Frame
):
class
Test
(
Frame
):
...
...
Demo/tkinter/matt/placer-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
# This is a program that tests the placer geom manager
# This is a program that tests the placer geom manager
...
...
Demo/tkinter/matt/pong-demo-1.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
import
string
import
string
...
...
Demo/tkinter/matt/printing-coords-of-items.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/radiobutton-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/rubber-band-box-demo-1.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
class
Test
(
Frame
):
class
Test
(
Frame
):
def
printit
(
self
):
def
printit
(
self
):
...
...
Demo/tkinter/matt/rubber-line-demo-1.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
class
Test
(
Frame
):
class
Test
(
Frame
):
def
printit
(
self
):
def
printit
(
self
):
...
...
Demo/tkinter/matt/slider-demo-1.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/subclass-existing-widgets.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
# This is a program that makes a simple two button application
# This is a program that makes a simple two button application
...
...
Demo/tkinter/matt/two-radio-groups.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/window-creation-more.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/window-creation-simple.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
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
...
...
Demo/tkinter/matt/window-creation-w-location.py
View file @
d6d63f54
from
T
kinter
import
*
from
t
kinter
import
*
import
sys
import
sys
##sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
##sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment