classification
Title: tkinter windows turn black while resized using Tk 8.6.9.1 on macOS
Type: behavior Stage: resolved
Components: macOS, Tkinter Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, rhettinger, ronaldoussoren, serhiy.storchaka, terry.reedy, wordtech
Priority: Keywords: 3.7regression

Created on 2018-12-13 20:22 by terry.reedy, last changed 2019-02-03 05:58 by ned.deily. This issue is now closed.

Messages (15)
msg331769 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-13 20:22
I updated to Mohave and did *not* switch to new dark theme.]
I installed 64 bit 3.7.2rc1.  Start IDLE.

import tkinter
root = tkinter.Tk()

Black on white Tk window appears.  Move mouse until resize arrow appears. Left click.  Move mouse.  Window turns uniformly black.  Ugh.  Cannot see contents that am trying to resize to.  Release button.  Background returns to white.  Same thing happens with Text added, and hence with IDLE windows and such dialogs as can be resized.
msg331777 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-12-14 03:40
Cannot reproduce this with the tip of Tk core-8-6-branch on Mojave and IDLE 3.7.1. Window appears normal and no flickering when resizing.
msg331780 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-14 04:34
I presume that tip has patches not in the distributed 8.6.9.  Ned, if my system is not unique and this is fixed by an identifiable patch, please consider including it.
msg332248 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-20 19:31
I'm seeing the same behavior, Terry. The installer's version was built from the Tk 8.6.9.1 release. I'll try building Tk from the core-8-6-branch unless Kevin has a better idea.
msg332250 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-20 19:34
Also, to be clear, I'm seeing any IDLE window turn completely black while resizing including IDLE's shell window; the "import tkinter" ... commands aren't necessary to see the problem.
msg332268 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-20 21:52
The point of the minimal code snippet is that the behavior is tk/tkinter generic and not specific to Texts or IDLE or particular non-default parameters or geometry.
msg332269 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-20 21:58
> The point of the minimal code snippet is that the behavior is tk/tkinter generic

Ah!
msg332274 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-12-20 22:59
http://core.tcl.tk/tk/tktview?name=ef9c3730e3 has some useful information on this from the Tk side.
msg332310 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-21 23:36
Based on the discussion here and in Issue35387, I built and tested macOS installers for 3.7.2rc1+ and 3.6.8rc1+ using the current tip of the Tk core-8-6-branch (https://core.tcl.tk/tk/info/deb6ecc05e4202e3); I continued to build Tcl from the Tcl 8.6.9 release tarball.  As a reminder, for 3.7.2rc1 and 3.6.8rc1, I used the Tk 8.6.9.1 release tarball with Tcl 8.6.9.

With the current Tk tip, the problem described in this issue seems to have been fixed: Tk windows did not turn black while they were being resized.

However, new regressions appeared.  First, the problem described in Issue35387 is now visible, that is, a separate blank window appears when selecting either "About IDLE" or "Preferences" from the application cascade in the application's menu bar at the top of the screen.  (Note that when launching IDLE.app (by double-clicking on the IDLE icon, for example), that menu cascade is normally labeled "IDLE" but when launching IDLE from the command line, for example, with "python -m idledlib" the menu cascade will usually be labeled "Python" instead of "IDLE"; this is normal behavior.)  These days, it is also possible to bring up the IDLE's Preferences window by using the Options -> Configure IDLE menu.  In that case, the spurious blank window does *not* appear.  If I recall correctly, both the About menu item and the Preferences menu items (but not the Options menu items) are special menu items automatically provided by Tk and/or macOS and that IDLE has code to customize, so that may be a good lead.

Second, I happened to notice that, when running a Python program with a syntax error from an IDLE edit window, the syntax error pop-down message appears twice.  A sequence to reproduce:
!. Open a new edit window (cmd-N).
2. Type: x = $1
3. Save to a file (cmd-S).
4. Run the program (F5).
5. The expected "Invalid syntax" panel pulls down on the edit window.
6. Click the OK button in the panel to dismiss.
7. The panel disappears but is immediately replaced by a second and identical "Invalid syntax" panel. (This is new and incorrect behavior).
8. Again click the OK button in the panel to dismiss.  This time the panel goes away and does not reappear.

Third, running Python test_idle causes a segfault.  From the traceback displayed, it appears that the failing test is calling idlelib/configdialog.py so I wouldn't be surprised if this failure is related to the first issue above, i.e. the appearance of the blank window when Preferences is chosen.  To reproduce, from a Terminal command line:

/path/to/python -m test -w -uall -j3 test_idle

where /path/to/python might be /usr/local/bin/python3.6 (or 3.7)

To make it easier to reproduce the problems, I've made test installers built with the Tk core-8-6-branch temporarily available on python.org.  These are similar to but not exactly the same as what is planned for 3.7.2 final and 3.6.8 final.

https://www.python.org/ftp/python/devtest/python-3.7.2rc1+-macosx10.9.pkg
https://www.python.org/ftp/python/devtest/python-3.6.8rc1+-macosx10.9.pkg
msg332313 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-22 00:05
At the moment, I am holding the 3.7.2 and 3.6.8 final releases for this and another unrelated regression.  I don't want to hold up these releases for all platforms just for issues related to use of Tk, tkinter, and/or IDLE on macOS.  There doesn't seem to be any one really good option, though, pending real fixes or workarounds.  The options I see are:

1. revert to Tcl/Tk 8.6.8 as was used with 3.7.1 and 3.6.7.  At this point, I don't remember all of the problems seen with that version of Tk, though I believe one was the scrolling problem described in Issue34370.

2. continue with Tk 8.6.9.1 as shipped with 3.7.2rc1 and 3.6.8rc1.  As far as a I know at the moment, the only regression there is the problem originally described in this issue, that is, windows temporarily turning black while being resized.

3. use the tip of Tk core-8-6-branch despite the problems described above.

4. look at reverting to Tcl/Tk 8.5.x and hope it works on the latest releases of macOS.  (Note that the macOS Installers and the Tcl/Tk they use are built on macOS 10.9 and 10.6 depending on the installer variant.)

5. hold the release for Tk and/or tkinter and/or IDLE fixes

None of those are really good options.  I would rule out option 3 based on my quick tests. I don't think going to 8.5.x is a viable option at this point, either, and certainly not desirable.  I really don't want to hold the release for a permanent fix or fixes unless they were likely to be available in the next 24 hours or so, since this is strictly a python.org macOS issue (although other distributors of Python and Tk on macOS will likely run into these problems).

That leaves either option 1 or 2. Of the 2, at this point, I lean towards option 2 assuming no other regressions are noted, it wouldn't be the end of the world to live for awhile with the temporary black window while resizing.  It's ugly but probably not as ugly as the scrolling problems that would remain with option 1.

In any case, if we do go ahead and release with one of these compromises, I would document it in the release notes and would also push to release updated installers for these releases as soon as fixes are available, with the proviso that the updated installers vary from the original release installers only in Tk code and any necessary tkinter or IDLE change(s) to correct these issues, i.e. no changes in any other components in the release.

Any other opinions??
msg332321 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-22 04:42
Raymond, as Ned explains above, there seem to be no really good options for the upcoming releases on Mac.  The *ed paragraph below has my best guess at to whether a Mac-IDLE user should install or ignore.
---

Basic options A, to hold up the release (indefinitely) on all platforms, has precedents, but usually because of bug(s) affecting more than one platform, and usually AFAIK for at most a week.  We have already closed 3.6 to routine maintenance and merged multiple patches into the future 3.7.3.  Withholding the current set of bug fixes does no one any good except possibly for people using resizable tkinter windows on Mac.

Option B, to hold up the release on only one platform is unprecedented as far as I know.  Option C, to release with one more known bug than we would like is relatively normal.  Given the indefiniteness of a fix, I agree with C.

AS for which version of C, I agree that option 2 above seems least bad.  The main issue with option 1, staying with 8.6.8, is how it performs (or rather, fails to perform)  on the new macOS Mohave.  Before opening this issue, I did fairly extensive testing of IDLE 3.7.2rc1 on Mohave and this was the only problem I encountered.

* As far as IDLE goes, what's new in 3.7.2/3.6.8 are mostly doc changes that are already online.  A user who has not upgraded to Mohave could consider staying with the existing releases. I suspect that a user running Mohave will be happier with the new releases with the tcl/tk upgrade. 

I thought of augmenting the the interactive splash notice, but this would give too much attention and emphasis to only 1 of many known but unfixed bugs, and 1 that only affects resizable tkinter windows on Mac.

Perhaps the hopefully temporary Mac installers should be labeled internally and on the splash screen as ...rc2 even if temporarily included on the 'final' download page with the final releases for other platforms.  I believe some people would object is two slightly different releases were called '3.6.8' and '3.7.2'.
msg332423 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-24 12:35
Update: After producing release installers for 3.7.2 and 3.6.8 using Tk 8.6.9.1 (option 2 above), I ran into a new and much more severe regression.  For macOS 10.14 (Mojave), the only regression I know of remains the "window turning black while resizing" issue.  However, when I did a quick test with macOS 10.13 and a few older systems, I found that, while they didn't exhibit the resizing issue, attempts to open IDLE's Settings (Preferences) window or the "About IDLE" window caused IDLE to become inoperative, requiring a Force Quit to exit.  10.14 does not seem to exhibit this behavior.  Given that, I felt we had no choice but to fall back to Tcl/Tk 8.6.8 (option 1).  When linked with 8.6.8, IDLE exhibited neither the screen size issue nor the inoperative issue on the systems I quick tested (10.8, 10.13, and 10.14).

Needless to say, this has not been very encouraging. I think someone (not me) needs to follow up on these issues with the Tk folks, perhaps open issues on the Tk tracker especially if they can be duplicated without Python. We also can't rule out the need for IDLE or tkinter changes to accommodate Tk fixes for long standing problems.

I will leave available the test installers I produced last week with the top of trunk 8.6.x to make it easier to experiment with.
msg332515 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-25 20:20
https://stackoverflow.com/questions/53923262/pyenv-installed-version-opening-idle-in-black-screen reports that with 3.6.7 in a venv running on Mac Mohave (with 3.7.2 installed), IDLE opens with a black screen.  Is there another report like this?
msg332516 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-12-25 20:44
It depends what version of Tcl/Tk is used and on what version of macOS the Tk is built on. I believe there were problems with versions of Tk bout on 10.14 Mojave that have been fixed perhaps in the latest version of Tk. Kevin May know more. It’s not a problem for the python.org macOS installers because we don’t build any on 10.14 even though they install and run on 10.14.
msg334787 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-02-03 05:58
Since this isn't a Python issue and since the specific problems seen using python.org macOS Pythons have gone away by reverting to using Tk 8.6.8, there doesn't seem to be a good reason to leave this issue open, certainly not as a "deferred blocker".  Keven Walzer is CCed on this so the Tk project is aware of the issues we saw with 8.6.9.1 and with core-8-6-branch as of 2018-12-24.  At this point, I'm not inclined to do any more testing of Tk until there is a new release but anyone else is welcome to go at it.
History
Date User Action Args
2019-02-03 05:58:57ned.deilysetstatus: open -> closed
priority: deferred blocker ->
title: Mac: tkinter windows turn black while resized -> tkinter windows turn black while resized using Tk 8.6.9.1 on macOS
messages: + msg334787

resolution: third party
stage: needs patch -> resolved
2018-12-28 00:50:33ned.deilylinkissue35402 superseder
2018-12-25 20:44:47ned.deilysetmessages: + msg332516
2018-12-25 20:20:41terry.reedysetmessages: + msg332515
2018-12-24 12:35:44ned.deilysetpriority: release blocker -> deferred blocker

messages: + msg332423
2018-12-22 04:42:42terry.reedysetnosy: + rhettinger
messages: + msg332321
2018-12-22 00:14:44ned.deilylinkissue35387 superseder
2018-12-22 00:05:15ned.deilysetmessages: + msg332313
2018-12-21 23:36:59ned.deilysetmessages: + msg332310
2018-12-20 22:59:10wordtechsetmessages: + msg332274
2018-12-20 21:58:30ned.deilysetmessages: + msg332269
2018-12-20 21:52:47terry.reedysetmessages: + msg332268
2018-12-20 19:34:35ned.deilysetmessages: + msg332250
2018-12-20 19:31:52ned.deilysetmessages: + msg332248
2018-12-14 04:34:09terry.reedysetkeywords: + 3.7regression

messages: + msg331780
2018-12-14 03:40:14wordtechsetmessages: + msg331777
2018-12-13 20:23:02terry.reedysetnosy: + serhiy.storchaka
2018-12-13 20:22:39terry.reedycreate