3 # This demonstration script creates a Ttk pane with some content.
5 if {![info exists widgetDemo
]} {
6 error "This script should be run from the \"widget\" demo."
15 wm title
$w "Themed Nested Panes"
16 wm iconname
$w "ttkpane"
19 ttk
::label $w.msg
-font $font -wraplength 4i
-justify left
-text "This demonstration shows off a nested set of themed paned windows. Their sizes can be changed by grabbing the area between each contained pane and dragging the divider."
20 pack $w.msg
[ttk
::separator $w.msgSep
] -side top
-fill x
23 pack [addSeeDismiss
$w.seeDismiss
$w] -side bottom
-fill x
26 pack $w.f
-fill both
-expand 1
28 ttk
::panedwindow $w.outer
-orient horizontal
29 $w.outer add
[ttk
::panedwindow $w.outer.inLeft
-orient vertical
]
30 $w.outer add
[ttk
::panedwindow $w.outer.inRight
-orient vertical
]
31 $w.outer.inLeft add
[ttk
::labelframe $w.outer.inLeft.top
-text Button
]
32 $w.outer.inLeft add
[ttk
::labelframe $w.outer.inLeft.bot
-text Clocks
]
33 $w.outer.inRight add
[ttk
::labelframe $w.outer.inRight.top
-text Progress
]
34 $w.outer.inRight add
[ttk
::labelframe $w.outer.inRight.bot
-text Text
]
35 if {[tk windowingsystem
] eq
"aqua"} {
36 foreach i
[list inLeft.top inLeft.bot inRight.top inRight.bot
] {
37 $w.outer.
$i configure
-padding 3
41 # Fill the button pane
42 ttk
::button $w.outer.inLeft.top.b
-text "Press Me" -command {
43 tk_messageBox -type ok
-icon info -message "Ouch!" -detail "That hurt..." \
44 -parent .ttkpane
-title "Button Pressed"
46 pack $w.outer.inLeft.top.b
-padx 2 -pady 5
48 # Fill the clocks pane
50 proc every
{delay script
} {
52 after $delay [list every
$delay $script]
56 :America
/Argentina
/Buenos_Aires
66 # Force a pre-load of all the timezones needed; otherwise can end up
67 # poor-looking synch problems!
68 foreach zone
$zones {clock format 0 -timezone $zone}
70 set city
[string map
{_
" "} [regexp -inline {[^
/]+$} $zone]]
72 pack [ttk
::separator $w.outer.inLeft.bot.s
$i] -fill x
74 ttk
::label $w.outer.inLeft.bot.l
$i -text $city -anchor w
75 ttk
::label $w.outer.inLeft.bot.t
$i -textvariable time($zone) -anchor w
76 pack $w.outer.inLeft.bot.l
$i $w.outer.inLeft.bot.t
$i -fill x
77 every
1000 "set time($zone) \[clock format \[clock seconds\] -timezone $zone -format %T\]"
81 # Fill the progress pane
82 ttk
::progressbar $w.outer.inRight.top.progress
-mode indeterminate
83 pack $w.outer.inRight.top.progress
-fill both
-expand 1
84 $w.outer.inRight.top.progress start
87 if {[tk windowingsystem
] ne
"aqua"} {
88 # The trick with the ttk::frame makes the text widget look like it fits with
89 # the current Ttk theme despite not being a themed widget itself. It is done
90 # by styling the frame like an entry, turning off the border in the text
91 # widget, and putting the text widget in the frame with enough space to allow
92 # the surrounding border to show through (2 pixels seems to be enough).
93 ttk
::frame $w.outer.inRight.bot.f
-style TEntry
94 text $w.txt
-wrap word
-yscroll "$w.sb set" -width 30 -borderwidth 0
95 pack $w.txt
-fill both
-expand 1 -in $w.outer.inRight.bot.f
-pady 2 -padx 2
96 ttk
::scrollbar $w.sb
-orient vertical
-command "$w.txt yview"
97 pack $w.sb
-side right
-fill y
-in $w.outer.inRight.bot
98 pack $w.outer.inRight.bot.f
-fill both
-expand 1
99 pack $w.outer
-fill both
-expand 1
101 text $w.txt
-wrap word
-yscroll "$w.sb set" -width 30 -borderwidth 0
102 scrollbar $w.sb
-orient vertical
-command "$w.txt yview"
103 pack $w.sb
-side right
-fill y
-in $w.outer.inRight.bot
104 pack $w.txt
-fill both
-expand 1 -in $w.outer.inRight.bot
105 pack $w.outer
-fill both
-expand 1 -padx 10 -pady {6 10}