Tk Source Code

View Ticket
Login
Ticket UUID: 3d10c64866be5c3b371f72859a1e5f00d4caa699
Title: systray needs `wm withdraw .` on Debian/Xfce
Type: Bug Version: 8.7 and 9.0
Submitter: mnsummerfield Created on: 2023-06-06 11:25:58
Subsystem: (unused) Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2023-06-07 06:36:14
Resolution: Invalid Closed By: mnsummerfield
    Closed on: 2023-06-07 06:36:14
Description:
See https://groups.google.com/g/comp.lang.tcl/c/-WpevvTKcs8
for more info.
User Comments: mnsummerfield added on 2023-06-07 06:36:14:
Expected behavior.

kevin_walzer added on 2023-06-07 01:02:28:
An image for the systray icon must be created before anything else. Are you doing that?

mnsummerfield added on 2023-06-06 12:00:13:
I've just installed the Tcl/Tk 8.7a's.
In https://www.tcl.tk/man/tcl8.7/TkCmd/systray.html two egs are given.
The first one fails with:

Error in startup script: systray not created
while executing
"tk systray configure -image book_page -text "Updated sample" \
-button1 {puts "Different output from the tk systray"} \
-button3 {puts "and more dif..."
(file "/tmp/a.tcl" line 3)

But the second one works. However, the second one also creates a spurious main window, so I think the complete second example should be this:

#!/usr/bin/env wish
image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
tk systray create -image book -text "tk systray sample" \
-button1 {puts "Here is the tk systray output"} \
-button3 {puts "here is alternate output"}
wm withdraw .

(Note that the line starting `image create` is a single line up to and including the `==` at the end.) 

Then later:

I tried with Tcl8.7/Tk8.7 and Tcl9.0/Tk8.7. In both cases I had to add the `wm withdraw .` command. Here's the code I used:

#!/usr/bin/env wish
puts "Tcl v$tcl_version/Tk v$tk_version"
image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw==
tk systray create -image book -text "tk systray sample" \
-button1 {puts "Here is the tk systray output"} \
-button3 {puts "Quit"; exit }
wm withdraw .

oehhar added on 2023-06-06 11:43:11:

The title is "systray needs `wm withdraw .` on Debian/Xfce". This is probably ok and by design. May I close the ticket ?

Take care, Harald