Tk Source Code

View Ticket
Login
Ticket UUID: 1d926db5668056fef9bb2a77f081d5c57c88e3f5
Title: Can't toggle visibility of Tk app main menu with main window maximised
Type: Bug Version: 8.6
Submitter: anonymous Created on: 2024-01-03 11:39:19
Subsystem: 12. Unix Menus Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2024-01-14 19:31:01
Resolution: None Closed By: nobody
    Closed on:
Description:
I'm trying to toggle the visibility of the main menu in a Tk app. It works fine if the main window isn't maximised, but if the window is maximised, the menu stops toggling. I've tried it on an Ubuntu machine and also a Rocky Linux machine, and it fails on both. Also confirmed on #tcl chat. A code snippet is below.

package require Tk

wm title . menu
menu .menubar
.menubar add command -label hello -command "puts hi"
bind . <Alt-KeyPress-m>  toggleMenu

proc toggleMenu {} {
    if {[. cget -menu] eq ""} {
        . configure -menu .menubar
    } else {
        . configure -menu ""
    }
}
User Comments: fvogel added on 2024-01-14 19:31:01:

Reproduced on Linux Debian 11.

Note that :

  • When the window is maximized, toggling the menu really works as expected once.
  • In fact, toggling the menu really works (even more than once) when the window is maximized. You can observe this by quitting the maximized mode and notice that the menu is present (or not, depending on how many thimes you toggled it). The toggling works, but the display doesn't follow up after the first toggling.


fvogel added on 2024-01-03 20:33:56:
For the records (since this is reported as a Linux issue), this works as expected on Win 11.