diff options
Diffstat (limited to 'library/demos/windowicons.tcl')
-rw-r--r-- | library/demos/windowicons.tcl | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/library/demos/windowicons.tcl b/library/demos/windowicons.tcl new file mode 100644 index 0000000..0c1e0c0 --- /dev/null +++ b/library/demos/windowicons.tcl @@ -0,0 +1,108 @@ +# windowicons.tcl -- +# +# This demonstration script showcases the wm iconphoto and wm iconbadge commands. +# + +if {![info exists widgetDemo]} { + error "This script should be run from the \"widget\" demo." +} + +set w .windowicons +destroy $w +toplevel $w +wm title $w "Window Icon Demonstration" +positionWindow $w + +## See Code / Dismiss buttons +pack [addSeeDismiss $w.buttons $w] -side bottom -fill x + +image create photo icon -data { + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGP + C/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3Cc + ulE8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAArQNAAK0DQEdFIm+AAAJ + QElEQVRYw+WXW2xdV5nHf/ty7lcf2/FxYsdOnMSNC0HTpDiRKJWAQjWCEQNU + SEAFfUOiQqrEC2+IxwpemDLSzNBBCCQeQEKqRJgBSikiuGlN22TqhsR27OPL + 8eWc43Pdt7X22osHHydOm4FBPM6Slr69paX9/32Xtb614f/7MP6vC3O5f8L3 + G7HJyZPHBwfz5wrF7HQ6nRwxLTOhQuU4PW+z3eq9Xa+33rq9cms7k8pHjvfS + 3w8wOfk52u1u8oHpiUff897JJ8+dO/nI6LHho6OjQ3ahkMYwTTZ2O2zXutS3 + G/7ayubq7Vtr/7Ve2f7RytLam4ViXq1t/vRvB0ilPsjzz3+LZ5/9j7MzM5Nf + /8hj5//5H97/YNbK5hkfTFLMxAEQQvD766v0yBGIEBEEuPUGi9dv7lx77cb3 + Vm9vfqc0WNi9evUKWr/xLh3rfuLj45+l0bjM7m768U98/OJ/fulLH/3wiemx + eCafxRcKw7TJxKC+12R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baBirRdB4f5mH + oTeuJlUxYoly8nRRxHW4HahO30SvmI5Y+CCBF4dPhzg0CYwOLs45GdKfG+sK + hBuy2H4xUlM1i76+BhcBwwirLj/bAlJqjXXzP9UyxmuHzp8feiknLPW6Q/H9 + moy3yK1oqvROUE2yH99suX45PwEyf2MTOoCNrQAAABl0RVh0U29mdHdhcmUA + d3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABWdEVYdFNvdXJjZQBodHRwczovL29w + ZW5jbGlwYXJ0Lm9yZy9kZXRhaWwvMzUyMzMvdGFuZ28taW5ldHJuZXQtd2Vi + LWJyb3dzZXItYnktd2Fyc3phd2lhbmth5nAuRgAAACB0RVh0VGl0bGUAdGF + uZ28gaW5ldHJuZXQgd2ViIGJyb3dzZXLyr62TAAAAAElFTkSuQmCC +} + +set ::tk::icons::base_icon(.) icon + +# Create a copy of the image just created, magnified according to the +# display's DPI scaling level. Since the zooom factor must be an integer, +# the copy will only be effectively magnified if $tk::scalingPct >= 200. +image create photo icon2 +icon2 copy icon -zoom [expr {$tk::scalingPct / 100}] + +pack [button $w.i -text "Set Window Icon to Globe" -image icon2 \ + -compound top -command {wm iconphoto . icon}] -fill x -padx 3p +pack [button $w.b -text "Set Badge to 3" -command {wm iconbadge . 3}] \ + -fill x -padx 3p +pack [button $w.e -text "Set Badge to 11" -command {wm iconbadge . 11}] \ + -fill x -padx 3p +pack [button $w.f -text "Reset Badge" -command {wm iconbadge . ""}] \ + -fill x -padx 3p |