This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Update turtledemo menu creation
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Lita.Cho, ned.deily, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2014-07-25 07:45 by terry.reedy, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
turtledemo_menu.patch serhiy.storchaka, 2014-07-25 08:23 review
Messages (12)
msg223927 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-25 07:45
On #22061, Serhiy Storchaka posted turtledemo_menu.patch, which is unrelated to that issue. Issues in that patch.
* It mistakenly includes the tkinter_restore_empty_methods.patch that does belongs to 22061.
* It will not apply any more, especially to 3.4 as it is now.
* Removing the gridding of the Menu seems like a mistake, or else the rest of the grid code should be revised.  I will test this.

Serhiy claims the patch "replaces obsolete and non-working menu creation code by modernized code. Now menu should be correctly displayed on MacOS."

'Obsolete' is correct' The current code uses Menubutton, "obsolete since Tk8.0". Updating, even for 2.7, would probably be a good idea.

As for 'non-working': the current code works on Windows, but I have no idea on Linux or Mac. Can either of you comment?  I certainly would want an updated patch tested on more than Windows.
msg223930 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-07-25 08:23
Here is updated patch.

* Excluded the tkinter_restore_empty_methods.patch.
* Synchronized with tip.
* Corrected grid row indices (this doesn't matter, in any case menu was removed from grid on Mac).

Current code doesn't work as was designed (with using obsolete tk_menuBar()). There is no observable differences on Linux (where menu is just a widget inside main window, as other frames and buttons), but they should be on Windows (menu is special thing and created internally with special API) and on Mac (menu is displayed separately from a window, at the top of the screen). The purpose of tk_menuBar() was to create such system-specific menu.
msg224003 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-07-25 21:12
Nice insight, Serhly!  The patch addresses the menu concern I brought up in msg223631 of Issue21933.  I evaluated the patch with all three OS X Tk variants (Cocoa, Carbon, and X11) and it looked good to me.  The only review comment I have is that ideally, with Cocoa or Carbon Tk's, the "About ..." menu item in the "Apple" menu row would be customized to display the "aboutTurtleDemo" window; as it stands, it defaults to a Tk-supplied "about Tk" window.  The problem with doing that is that there are Tk-variant-specfic (Cocoa vs Carbon) ways to do that and it shouldn't be done at all for X11 so the implementation would get a bit messy;  the relevant code for IDLE is in macosxSupport.py towards the end of overrideRootMenu().  It's probably overkill for turtledemo so I'm OK with the patch as it stands (note I did not try it on any other platform).
msg225262 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-13 07:26
Terry?
msg225292 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-14 07:36
# 3 on my list of patches to review and apply
msg225335 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-15 04:53
The two misdirected and unlinked changeset notices belong to #22053.
(Not completely off, as they synchronize 3.4 and 3.5 so I can start work on this.)
msg225339 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-15 05:23
New changeset 39c67beb483a by Terry Jan Reedy in branch '3.4':
Issue #22065: Update turtledemo menu creation; don't use obsolete Menubutton.
http://hg.python.org/cpython/rev/39c67beb483a
msg225342 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-15 05:46
The changes to help menu creation in #22053 required hand patching of the last chunk, but that was pretty easy. The code definitely looks better for the change.

After pushing, I compared the look to 2.7. The first letters are not underlined, but Alt-<first letter> works, as on Idle (where File prevent key access to Format). This looks better, but I don't know if the underline helps beginners.

In spite of
       self.mBar.add_cascade(menu=self.makeLoadDemoMenu(self.mBar),
                          label='Examples', underline=0, font=menufont)
passing menufont, the font for the menubar entries, 'Examples' and 'Help', is no longer the 12 pt menufont, but looks like 10 pt (as on Idle). It is initially lighter than it was before until clicked. The dropdown entries (added with add_command instead of add_cascade) do use the 12 pt menufont as passed. The size difference looks a bit strange. So if anyone knows why, speak up.
msg225944 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-27 05:44
New changeset b671092e08fa by Terry Jan Reedy in branch '3.4':
Issue #22065: Menus, unlike Menubottons, do not have a state option.
http://hg.python.org/cpython/rev/b671092e08fa
msg225945 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-27 05:51
Before the patch, the Examples menu was disabled while a demo was running by setting the Menubutton state to DISABLED versus NORMAL. This does not work for the cascaded Menu.  The result was buggy behavior when loading a new demo while the previous one was running.

Since having the menu disabled was annoying anyway, I changed the loading code to do what the Stop button does. I also cleaned up the control flow of a couple of related functions and the return value for the Nim demo.

The next patch will removed the now unused menu state setting.
msg225946 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-27 05:59
New changeset a94d9c981461 by Terry Jan Reedy in branch '3.4':
Issue #22065: Remove the now unsed configGUI menu parameter and arguments.
http://hg.python.org/cpython/rev/a94d9c981461
msg225948 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-27 06:04
Since the menu argument was the 'opposite' of the stop argument, both in theory and practice, it was never needed as a parameter/argument. configGUI could have had the following first line to create it.
    menu = NORMAL if stop == DISABLED else DISABLED
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66263
2014-08-27 06:04:31terry.reedysetmessages: + msg225948
2014-08-27 05:59:22python-devsetmessages: + msg225946
2014-08-27 05:51:41terry.reedysetmessages: + msg225945
2014-08-27 05:44:33python-devsetmessages: + msg225944
2014-08-15 05:46:51terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg225342

stage: patch review -> resolved
2014-08-15 05:24:00python-devsetmessages: + msg225339
2014-08-15 04:53:19terry.reedysetmessages: + msg225335
2014-08-15 04:51:59terry.reedysetmessages: - msg225333
2014-08-15 04:51:49terry.reedysetmessages: - msg225332
2014-08-15 04:48:17python-devsetmessages: + msg225333
2014-08-15 04:39:46python-devsetnosy: + python-dev
messages: + msg225332
2014-08-14 07:36:38terry.reedysetmessages: + msg225292
2014-08-13 07:26:00serhiy.storchakasetmessages: + msg225262
2014-07-25 21:12:19ned.deilysetmessages: + msg224003
stage: needs patch -> patch review
2014-07-25 08:23:17serhiy.storchakasetfiles: + turtledemo_menu.patch

nosy: + serhiy.storchaka
messages: + msg223930

keywords: + patch
2014-07-25 07:45:42terry.reedycreate