home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 44
/
Amiga_Dream_44.iso
/
Linux
/
Pratique
/
Tcltk
/
packer.tcl
< prev
next >
Wrap
Text File
|
1997-09-10
|
7KB
|
194 lines
######################################
# packer.tcl #
######################################
# fonctionnement du packer #
######################################
# cadre du haut
frame .frame1 -relief sunken -borderwidth 2
# label "Widget"
label .frame1.label -text "Widget" -relief groove -borderwidth 2
# cadre "commandes"
frame .frame2 -relief flat -borderwidth 1
# cadre "Side"
set SideMode "top"
frame .frame2.frame0 -relief raised -borderwidth 2
label .frame2.frame0.label -text "Side" -relief groove -borderwidth 2
radiobutton .frame2.frame0.topbtn -text "Top" -variable SideMode -value "top" -command UpdateWidget
radiobutton .frame2.frame0.leftbtn -text "Left" -variable SideMode -value "left" -command UpdateWidget
radiobutton .frame2.frame0.rightbtn -text "Right" -variable SideMode -value "right" -command UpdateWidget
radiobutton .frame2.frame0.bottombtn -text "Bottom" -variable SideMode -value "bottom" -command UpdateWidget
# cadre "Fill"
set FillMode "none"
frame .frame2.frame1 -relief raised -borderwidth 2
label .frame2.frame1.label -text "Fill" -relief groove -borderwidth 2
radiobutton .frame2.frame1.nonebtn -text "None" -variable FillMode -value "none" -command UpdateWidget
radiobutton .frame2.frame1.xbtn -text "X" -variable FillMode -value "x" -command UpdateWidget
radiobutton .frame2.frame1.ybtn -text "Y" -variable FillMode -value "y" -command UpdateWidget
radiobutton .frame2.frame1.bothbtn -text "Both" -variable FillMode -value "both" -command UpdateWidget
# cadre "Expand"
set ExpandMode "false"
frame .frame2.frame2 -relief raised -borderwidth 2
label .frame2.frame2.label -text "Expand" -relief groove -borderwidth 2
radiobutton .frame2.frame2.truebtn -text "True" -variable ExpandMode -value "true" -command UpdateWidget
radiobutton .frame2.frame2.falsebtn -text "False" -variable ExpandMode -value "false" -command UpdateWidget
# cadre "external padding"
set PadX "0"
set PadY "0"
frame .frame2.frame3 -relief raised -borderwidth 2
label .frame2.frame3.label -text "External Padding" -relief groove -borderwidth 2
scale .frame2.frame3.padxscl -from "0" -to "80" -label "PadX" -showvalue "true" -variable PadX -orient "horizontal" -borderwidth 2 -relief raised -command UpdateWidgetScale
scale .frame2.frame3.padyscl -from "0" -to "80" -label "PadY" -showvalue "true" -variable PadY -orient "horizontal" -borderwidth 2 -relief raised -command UpdateWidgetScale
# cadre "internal padding"
set InPadX "0"
set InPadY "0"
frame .frame2.frame4 -relief raised -borderwidth 2
label .frame2.frame4.label -text "Internal Padding" -relief groove -borderwidth 2
scale .frame2.frame4.ipadxscl -from "0" -to "80" -label "IPadX" -showvalue "true" -variable IPadX -orient "horizontal" -borderwidth 2 -relief raised -command UpdateWidgetScale
scale .frame2.frame4.ipadyscl -from "0" -to "80" -label "IPadY" -showvalue "true" -variable IPadY -orient "horizontal" -borderwidth 2 -relief raised -command UpdateWidgetScale
# cadre "anchor"
set AnchorMode "center"
frame .frame2.frame5 -relief raised -borderwidth 2
label .frame2.frame5.label -text "Anchor" -relief groove -borderwidth 2
radiobutton .frame2.frame5.nbtn -text "North" -variable AnchorMode -value "n" -command UpdateWidget
radiobutton .frame2.frame5.nwbtn -text "North West" -variable AnchorMode -value "nw" -command UpdateWidget
radiobutton .frame2.frame5.nebtn -text "North East" -variable AnchorMode -value "ne" -command UpdateWidget
radiobutton .frame2.frame5.centerbtn -text "Center" -variable AnchorMode -value "center" -command UpdateWidget
radiobutton .frame2.frame5.wbtn -text "West" -variable AnchorMode -value "w" -command UpdateWidget
radiobutton .frame2.frame5.ebtn -text "East" -variable AnchorMode -value "e" -command UpdateWidget
radiobutton .frame2.frame5.swbtn -text "South West" -variable AnchorMode -value "sw" -command UpdateWidget
radiobutton .frame2.frame5.sebtn -text "South East" -variable AnchorMode -value "se" -command UpdateWidget
radiobutton .frame2.frame5.sbtn -text "South" -variable AnchorMode -value "s" -command UpdateWidget
# cadre "Commandes"
frame .frame2.frame6 -relief raised -borderwidth 2
label .frame2.frame6.label -text "Commands" -relief groove -borderwidth 2
button .frame2.frame6.quitbtn -text "Quit" -command exit
# cadre "Infos"
set InfoMessage "Starting packer.tcl ..."
frame .frame3 -relief sunken -borderwidth 2
label .frame3.message -textvariable InfoMessage
# procedure de mise a jour
proc UpdateWidget {} {
global SideMode FillMode ExpandMode PadX PadY IPadX IPadY AnchorMode InfoMessage
pack configure .frame1.label -side $SideMode -fill $FillMode -expand $ExpandMode -padx $PadX -pady $PadY -ipadx $IPadX -ipady $IPadY -anchor $AnchorMode
set InfoMessage "pack configure .label -side $SideMode -fill $FillMode -expand $ExpandMode -anchor $AnchorMode -padx $PadX -pady $PadY -ipadx $IPadX -ipady $IPadY"
update
}
proc UpdateWidgetScale { arg1} {
UpdateWidget
}
# Fenetre principale
wm title . "Packer demo"
wm geometry . 680x460
# Affichage des widgets
pack .frame1 -side top -expand true -fill both
pack .frame1.label -fill $FillMode -expand $ExpandMode
pack .frame2 -side top -fill x
pack .frame2.frame0 -side left -anchor s
pack .frame2.frame0.label -side top -fill x
pack .frame2.frame0.topbtn -side top -fill x
pack .frame2.frame0.leftbtn -side top -fill x
pack .frame2.frame0.rightbtn -side top -fill x
pack .frame2.frame0.bottombtn -side top -fill x
pack .frame2.frame1 -side left -anchor s
pack .frame2.frame1.label -side top -fill x
pack .frame2.frame1.nonebtn -side top -fill x
pack .frame2.frame1.xbtn -side top -fill x
pack .frame2.frame1.ybtn -side top -fill x
pack .frame2.frame1.bothbtn -side top -fill x
pack .frame2.frame2 -side left -anchor s
pack .frame2.frame2.label -side top -fill x
pack .frame2.frame2.truebtn -side top -fill x
pack .frame2.frame2.falsebtn -side top -fill x
pack .frame2.frame3 -side left -anchor s
pack .frame2.frame3.label -side top -fill x
pack .frame2.frame3.padxscl -side top -fill x
pack .frame2.frame3.padyscl -side top -fill x
pack .frame2.frame4 -side left -anchor s
pack .frame2.frame4.label -side top -fill x
pack .frame2.frame4.ipadxscl -side top -fill x
pack .frame2.frame4.ipadyscl -side top -fill x
pack .frame2.frame5 -side left -anchor n
pack .frame2.frame5.label -side top -fill x
pack .frame2.frame5.nbtn -side top -fill x
pack .frame2.frame5.nwbtn -side top -fill x
pack .frame2.frame5.nebtn -side top -fill x
pack .frame2.frame5.centerbtn -side top -fill x
pack .frame2.frame5.wbtn -side top -fill x
pack .frame2.frame5.ebtn -side top -fill x
pack .frame2.frame5.swbtn -side top -fill x
pack .frame2.frame5.sebtn -side top -fill x
pack .frame2.frame5.sbtn -side top -fill x
pack .frame2.frame6 -side right -anchor se
pack .frame2.frame6.label -side top -fill x
pack .frame2.frame6.quitbtn -side top -fill x
pack .frame3 -side bottom -anchor s -fill x
pack .frame3.message -side left