📄 msgbox.tcl
字号:
# msgbox.tcl --## This demonstration script creates message boxes of various type## RCS: @(#) $Id: msgbox.tcl,v 1.2 1998/09/14 18:23:29 stanton Exp $if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo."}set w .msgboxcatch {destroy $w}toplevel $wwm title $w "Message Box Demonstration"wm iconname $w "messagebox"positionWindow $wlabel $w.msg -font $font -wraplength 4i -justify left -text "Choose the icon and type option of the message box. Then press the \"Message Box\" button to see the message box."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"button $w.buttons.vars -text "Message Box" \ -command "showMessageBox $w"pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1frame $w.left frame $w.rightpack $w.left $w.right -side left -expand yes -fill y -pady .5c -padx .5clabel $w.left.label -text "Icon"frame $w.left.sep -relief ridge -bd 1 -height 2pack $w.left.label -side toppack $w.left.sep -side top -fill x -expand noset msgboxIcon infoforeach i {error info question warning} { radiobutton $w.left.b$i -text $i -variable msgboxIcon \ -relief flat -value $i -width 16 -anchor w pack $w.left.b$i -side top -pady 2 -anchor w -fill x}label $w.right.label -text "Type"frame $w.right.sep -relief ridge -bd 1 -height 2pack $w.right.label -side toppack $w.right.sep -side top -fill x -expand noset msgboxType okforeach t {abortretryignore ok okcancel retrycancel yesno yesnocancel} { radiobutton $w.right.$t -text $t -variable msgboxType \ -relief flat -value $t -width 16 -anchor w pack $w.right.$t -side top -pady 2 -anchor w -fill x}proc showMessageBox {w} { global msgboxIcon msgboxType set button [tk_messageBox -icon $msgboxIcon -type $msgboxType \ -title Message -parent $w\ -message "This is a \"$msgboxType\" type messagebox with the \"$msgboxIcon\" icon"] tk_messageBox -icon info -message "You have selected \"$button\"" -type ok\ -parent $w}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -