Posted to tcl by kevin_walzer at Tue Oct 20 11:25:22 GMT 2020view raw

  1. global iconmenu
  2.  
  3. set iconmenu .menubar
  4. menu $iconmenu
  5. $iconmenu add command -label "Status" -command { puts "status icon clicked" }
  6. $iconmenu add command -label "Exit" -command exit
  7.  
  8.  
  9. image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
  10.  
  11. pack [button .b1 -text "Modify" -image book -command modify]
  12. pack [button .b2 -text "Notify" -command notify]
  13. pack [button .b3 -text "Destroy" -command {tk systray destroy}]
  14.  
  15. tk systray create book "Systray sample" {puts "foo"} {tk_popup $iconmenu [winfo pointerx .] [winfo pointery .]}
  16.  
  17.  
  18. proc modify { } {
  19.  
  20. image create photo page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7
  21.  
  22. tk systray modify image page
  23. tk systray modify text "Modified text"
  24. tk systray modify b1_callback {puts "this is a different output"}
  25. tk systray modify b3_callback {puts "hello yall"}
  26.  
  27. }
  28.  
  29.  
  30. proc notify {} {
  31.  
  32. tk sysnotify "Alert" "This is an alert"
  33.  
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.