홈페이지: https://github.com/ch32n/slpanel
Tcl/Tk megawidget that provides animated, collapsible side panels.
애니메이션이 적용된 접고 펼수 있는 사이드 패널을 제공하는 Tcl/Tk 메가위젯입니다.
package require slpanel
set buttonFrame [ttk::frame .bf]
set toggle1 [ttk::button $buttonFrame.b1 -text "toggle 1"]
set toggle2 [ttk::button $buttonFrame.b2 -text "toggle 2"]
set close [ttk::button $buttonFrame.b3 -text "close all"]
grid $buttonFrame -row 0 -column 0 -sticky nsw
grid $toggle1 -row 0 -column 0 -sticky nw
grid $toggle2 -row 1 -column 0 -sticky nw
grid $close -row 2 -column 0 -sticky nw
# create sliding panel container
set slPanel [slpanel::create .slPanel]
grid $slPanel -row 0 -column 1 -sticky nesw
grid rowconfigure . 0 -weight 1
grid columnconfigure . 1 -weight 1
# get sliding panel main frame
set mainFrame [$slPanel getmainframe]
grid rowconfigure $mainFrame 0 -weight 1
grid columnconfigure $mainFrame 0 -weight 1
# create canvas on sliding panel main frame
set maincFcanv [canvas $mainFrame.mCanvas -background white]
grid $maincFcanv -row 0 -column 0 -sticky nesw
# add 2 sliding panels
set slFrame1 [$slPanel add sl1 -speed 130 -close 0.2 -anchor e -open 0.5]
set slFrame2 [$slPanel add sl2 -speed 10 -anchor e -open [winfo pixels . 7c] ]
# bind sliding panel frames virtual events on state change
foreach slFrame [list $slFrame1 $slFrame2] {
bind $slFrame <<slChange>> [list puts "Started state change on slFrame: $slFrame new state: %d"]
bind $slFrame <<slChangeDone>> [list puts "State change done on slFrame: $slFrame new state: %d"]
}
#create widgets in sliding panels
set maincFcanv1 [canvas $slFrame1.slCanvas1 -background red]
grid $maincFcanv1 -row 0 -column 0 -sticky nesw
grid rowconfigure $slFrame1 0 -weight 1
grid columnconfigure $slFrame1 0 -weight 1
set maincFcanv2 [canvas $slFrame2.slCanvas2 -background green]
grid $maincFcanv2 -row 0 -column 0 -sticky nesw
grid rowconfigure $slFrame2 0 -weight 1
grid columnconfigure $slFrame2 0 -weight 1
# close sliding panels when button1 click on main frame
bind $maincFcanv <Button-1> [list $slPanel closeopened]
# configure buttons
$toggle1 configure -command [list $slPanel togglepanel sl1]
$toggle2 configure -command [list $slPanel togglepanel sl2]
$close configure -command [list $slPanel closeopened]
'Tcl & Tk > 확장 패키지 (Extension Package)' 카테고리의 다른 글
TclIPv6 (0) | 2025.08.05 |
---|---|
collapseframe (0) | 2025.08.05 |
tcanvas 1.0 (0) | 2025.07.02 |
Tclcron 1.0 (0) | 2025.07.02 |
Tcl/Fltk 1.0.155 (0) | 2025.06.19 |