Tk Source Code

View Ticket
Login
Ticket UUID: 7a325ad72cbb6e331fbae3f4116fe112bda698f4
Title: Hidden menubuttons flicker on MacOS
Type: Bug Version: 8.5.17
Submitter: anonymous Created on: 2014-12-17 05:59:33
Subsystem: 11. Aqua Menus Assigned To: kevin_walzer
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2015-01-31 20:51:45
Resolution: Fixed Closed By: kevin_walzer
    Closed on: 2015-01-31 20:51:45
Description:
I have a log window with some hidable option menus. When new text is added the hidden option menus flicker. I have created a simple script to reproduce the problem. The problem is present in 8.5.17 and is not present in 8.5.11 or 8.5.9. I cannot speak to other version of Tcl/Tk or other operating systems.

Run the following script in wish:

# To see the flicker:
# - Run the script
# - Push the "Hide Wdg" button
# - Resize the widget, preferably in width; the hidden widget will be shown while resizing
#
# Variations:
# - I've used grid_forget and still see the flicker.
# - I do NOT see the flicker if the hidden widget is a Label or an Entry (instead of a MenuButton).

wm geometry . "200x50"
menubutton .wdg -text "Wdg"
grid .wdg -row 0 -column 1
button .btn -text "Hide Wdg" -command {grid remove .wdg}
grid .btn -row 0 -column 0
User Comments: kevin_walzer added on 2015-01-31 20:51:45:
Recent commits to trunk and core-8-5-branch have fixed this.

anonymous added on 2015-01-22 18:40:44:
I was wrong about the recent commit fixing things in my application. Due to a subtle error on my part I was accidentally using Apple's built-in Tcl/Tk (8.5.9). I see the same symptoms in my application as I reported for the demo: the flicker is still present and if I start to resize the window there is a roughly one second delay before resizing actually happens (though once it starts, the window border tracks the mouse fine after that). I saw in a recent posting that you have been working on further improving the drawing performance, so I'm hopeful the delay and flicker will both be fixed by that work.

anonymous added on 2015-01-05 21:41:03:
You have indeed improved things. I tested the current core_8_5_branch if tcl and tk as of 2015-01-15

As you warned, the simple test script does still show the hidden widget while resizing the window. In addition, I see an unexpected delay before attempting to resize actually causes anything to occur. I'm not sure what to make of that.

However, in my regular application (where the problem first appeared), your changes have completely eliminated the flicker! My original code was a log widget containing a scrolled text widget and some hideable widgets. With 8.5.17 a hidden menubutton would flicker when I resized the window, scrolled the text widget or added text to the text widget. With your fixes the hidden menubutton does not show up for any of these!

Thank you very much!

kevin_walzer added on 2014-12-24 04:54:37:
I've committed a fix that reduces the flickering in the menubutton widget in general, as well as improving performance during resizing of windows; the widget now looks fine when mapped. The widget still inexplicably renders during window resize when it is hidden, and I do not know how to get that resolved. You may still be better off working around the issue by using ttk menu buttons or destroying/redrawing the widget, as that seems to work fine. 

Please confirm that the update performs as I've indicated and I'll close this bug.

anonymous added on 2014-12-18 17:20:57:
Others have reported that the problem does not occur on linux. It really does seem to be Mac-specific.

fvogel added on 2014-12-18 06:56:52:
Can't see the problem on Windows Vista with 8.6.3 or 8.5.17.

apnadkarni added on 2014-12-18 02:18:04:
I don't see the problem on Windows 8 + Tcl/Tk 8.6.3

anonymous added on 2014-12-18 00:26:13:
With Tcl/Tk 8.6.3 on Mac OS X 10.9.5, with this script I got the following behavior:
1) If I push the "Hide Wdg" button, the Wdg widget indeed disappears.
2) If I resize the window, the Wdg widget reappears.
3) The Wdg widget disappears again if I click it, or if I click the "Hide Wdg" button, or if I change focus to a window of a different application.
4) If I return focus to Tcl/Tk, the Wdg widget flickers once and disappears.
5) If I return focus to Tcl/Tk by clicking on the edge of the window, the Wdg widget reappears. The Wdg widget disappears again if I click in the window, but it depends on exactly where in the white background I click.

The script works correctly on Linux with Tcl/Tk version 8.5.7. No flickering, no widgets magically reappearing.