3 # This demonstration script creates a Ttk pane with some content.
5 # RCS: @(#) $Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
7 if {![info exists widgetDemo
]} {
8 error "This script should be run from the \"widget\" demo."
17 wm title
$w "Themed Nested Panes"
18 wm iconname
$w "ttkpane"
21 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."
22 pack $w.msg
[ttk
::separator $w.msgSep
] -side top
-fill x
25 pack [addSeeDismiss
$w.seeDismiss
$w] -side bottom
-fill x
28 pack $w.f
-fill both
-expand 1
30 ttk
::panedwindow $w.outer
-orient horizontal
31 $w.outer add
[ttk
::panedwindow $w.outer.inLeft
-orient vertical
]
32 $w.outer add
[ttk
::panedwindow $w.outer.inRight
-orient vertical
]
33 $w.outer.inLeft add
[ttk
::labelframe $w.outer.inLeft.top
-text Button
]
34 $w.outer.inLeft add
[ttk
::labelframe $w.outer.inLeft.bot
-text Clocks
]
35 $w.outer.inRight add
[ttk
::labelframe $w.outer.inRight.top
-text Progress
]
36 $w.outer.inRight add
[ttk
::labelframe $w.outer.inRight.bot
-text Text
]
37 if {[tk windowingsystem
] eq
"aqua"} {
38 foreach i
[list inLeft.top inLeft.bot inRight.top inRight.bot
] {
39 $w.outer.
$i configure
-padding 3
43 # Fill the button pane
44 ttk
::button $w.outer.inLeft.top.b
-text "Press Me" -command {
45 tk_messageBox -type ok
-icon info -message "Ouch!" -detail "That hurt..." \
46 -parent .ttkpane
-title "Button Pressed"
48 pack $w.outer.inLeft.top.b
-padx 2 -pady 5
50 # Fill the clocks pane
52 proc every
{delay script
} {
54 after $delay [list every
$delay $script]
58 :America
/Argentina
/Buenos_Aires
68 # Force a pre-load of all the timezones needed; otherwise can end up
69 # poor-looking synch problems!
70 foreach zone
$zones {clock format 0 -timezone $zone}
72 set city
[string map
{_
" "} [regexp -inline {[^
/]+$} $zone]]
74 pack [ttk
::separator $w.outer.inLeft.bot.s
$i] -fill x
76 ttk
::label $w.outer.inLeft.bot.l
$i -text $city -anchor w
77 ttk
::label $w.outer.inLeft.bot.t
$i -textvariable time($zone) -anchor w
78 pack $w.outer.inLeft.bot.l
$i $w.outer.inLeft.bot.t
$i -fill x
79 every
1000 "set time($zone) \[clock format \[clock seconds\] -timezone $zone -format %T\]"
83 # Fill the progress pane
84 ttk
::progressbar $w.outer.inRight.top.progress
-mode indeterminate
85 pack $w.outer.inRight.top.progress
-fill both
-expand 1
86 $w.outer.inRight.top.progress start
89 if {[tk windowingsystem
] ne
"aqua"} {
90 # The trick with the ttk::frame makes the text widget look like it fits with
91 # the current Ttk theme despite not being a themed widget itself. It is done
92 # by styling the frame like an entry, turning off the border in the text
93 # widget, and putting the text widget in the frame with enough space to allow
94 # the surrounding border to show through (2 pixels seems to be enough).
95 ttk
::frame $w.outer.inRight.bot.f
-style TEntry
96 text $w.txt
-wrap word
-yscroll "$w.sb set" -width 30 -borderwidth 0
97 pack $w.txt
-fill both
-expand 1 -in $w.outer.inRight.bot.f
-pady 2 -padx 2
98 ttk
::scrollbar $w.sb
-orient vertical
-command "$w.txt yview"
99 pack $w.sb
-side right
-fill y
-in $w.outer.inRight.bot
100 pack $w.outer.inRight.bot.f
-fill both
-expand 1
101 pack $w.outer
-fill both
-expand 1
103 text $w.txt
-wrap word
-yscroll "$w.sb set" -width 30 -borderwidth 0
104 scrollbar $w.sb
-orient vertical
-command "$w.txt yview"
105 pack $w.sb
-side right
-fill y
-in $w.outer.inRight.bot
106 pack $w.txt
-fill both
-expand 1 -in $w.outer.inRight.bot
107 pack $w.outer
-fill both
-expand 1 -padx 10 -pady {6 10}