Skip to content

Update turtledemo menu creation #66263

Closed
Closed

Description

@terryjreedy
BPO 22065
Nosy @terryjreedy, @ned-deily, @serhiy-storchaka
Files
  • turtledemo_menu.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2014-08-15.05:46:51.040>
    created_at = <Date 2014-07-25.07:45:42.115>
    labels = ['type-bug']
    title = 'Update turtledemo menu creation'
    updated_at = <Date 2014-08-27.06:04:31.328>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2014-08-27.06:04:31.328>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2014-08-15.05:46:51.040>
    closer = 'terry.reedy'
    components = []
    creation = <Date 2014-07-25.07:45:42.115>
    creator = 'terry.reedy'
    dependencies = []
    files = ['36085']
    hgrepos = []
    issue_num = 22065
    keywords = ['patch']
    message_count = 12.0
    messages = ['223927', '223930', '224003', '225262', '225292', '225335', '225339', '225342', '225944', '225945', '225946', '225948']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'ned.deily', 'python-dev', 'serhiy.storchaka', 'Lita.Cho']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22065'
    versions = ['Python 3.4', 'Python 3.5']

    Activity

    1. terryjreedy commented on Jul 25, 2014

      @terryjreedy
      MemberAuthor

      On bpo-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.

    2. self-assigned this
      on Jul 25, 2014
    3. serhiy-storchaka commented on Jul 25, 2014

      @serhiy-storchaka
      Member

      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.

    4. ned-deily commented on Jul 25, 2014

      @ned-deily
      Member

      Nice insight, Serhly! The patch addresses the menu concern I brought up in msg223631 of bpo-21933. 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).

    5. serhiy-storchaka commented on Aug 13, 2014

      @serhiy-storchaka
      Member

      Terry?

    6. terryjreedy commented on Aug 14, 2014

      @terryjreedy
      MemberAuthor

      # 3 on my list of patches to review and apply

    7. terryjreedy commented on Aug 15, 2014

      @terryjreedy
      MemberAuthor

      The two misdirected and unlinked changeset notices belong to bpo-22053.
      (Not completely off, as they synchronize 3.4 and 3.5 so I can start work on this.)

    8. python-dev commented on Aug 15, 2014

      python-devmannequin
      Mannequin

      New changeset 39c67beb483a by Terry Jan Reedy in branch '3.4':
      Issue bpo-22065: Update turtledemo menu creation; don't use obsolete Menubutton.
      http://hg.python.org/cpython/rev/39c67beb483a

    9. terryjreedy commented on Aug 15, 2014

      @terryjreedy
      MemberAuthor

      The changes to help menu creation in bpo-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.

    10. python-dev commented on Aug 27, 2014

      python-devmannequin
      Mannequin

      New changeset b671092e08fa by Terry Jan Reedy in branch '3.4':
      Issue bpo-22065: Menus, unlike Menubottons, do not have a state option.
      http://hg.python.org/cpython/rev/b671092e08fa

    11. terryjreedy commented on Aug 27, 2014

      @terryjreedy
      MemberAuthor

      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.

    12. python-dev commented on Aug 27, 2014

      python-devmannequin
      Mannequin

      New changeset a94d9c981461 by Terry Jan Reedy in branch '3.4':
      Issue bpo-22065: Remove the now unsed configGUI menu parameter and arguments.
      http://hg.python.org/cpython/rev/a94d9c981461

    13. terryjreedy commented on Aug 27, 2014

      @terryjreedy
      MemberAuthor

      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

    14. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions