📄 clrpick.tcl
字号:
# clrpick.tcl --## This demonstration script prompts the user to select a color.## RCS: @(#) $Id: clrpick.tcl,v 1.2 1998/09/14 18:23:27 stanton Exp $if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo."}set w .clrpickcatch {destroy $w}toplevel $wwm title $w "Color Selection Dialog"wm iconname $w "colors"positionWindow $wlabel $w.msg -font $font -wraplength 4i -justify left -text "Press the buttons below to choose the foreground and background colors for the widgets in this window."pack $w.msg -side topframe $w.buttonspack $w.buttons -side bottom -fill x -pady 2mbutton $w.buttons.dismiss -text Dismiss -command "destroy $w"button $w.buttons.code -text "See Code" -command "showCode $w"pack $w.buttons.dismiss $w.buttons.code -side left -expand 1button $w.back -text "Set background color ..." \ -command \ "setColor $w $w.back background {-background -highlightbackground}"button $w.fore -text "Set foreground color ..." \ -command \ "setColor $w $w.back foreground -foreground"pack $w.back $w.fore -side top -anchor c -pady 2mproc setColor {w button name options} { grab $w set initialColor [$button cget -$name] set color [tk_chooseColor -title "Choose a $name color" -parent $w \ -initialcolor $initialColor] if [string compare $color ""] { setColor_helper $w $options $color } grab release $w}proc setColor_helper {w options color} { foreach option $options { catch { $w config $option $color } } foreach child [winfo children $w] { setColor_helper $child $options $color }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -