Posted to tcl by kevin_walzer at Tue Oct 20 11:25:22 GMT 2020view raw
- global iconmenu
- set iconmenu .menubar
- menu $iconmenu
- $iconmenu add command -label "Status" -command { puts "status icon clicked" }
- $iconmenu add command -label "Exit" -command exit
- image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
- pack [button .b1 -text "Modify" -image book -command modify]
- pack [button .b2 -text "Notify" -command notify]
- pack [button .b3 -text "Destroy" -command {tk systray destroy}]
- tk systray create book "Systray sample" {puts "foo"} {tk_popup $iconmenu [winfo pointerx .] [winfo pointery .]}
- proc modify { } {
- image create photo page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7
- tk systray modify image page
- tk systray modify text "Modified text"
- tk systray modify b1_callback {puts "this is a different output"}
- tk systray modify b3_callback {puts "hello yall"}
- }
- proc notify {} {
- tk sysnotify "Alert" "This is an alert"
- }