Skip to content

IDLE add font resizing hot keys and wheel #61842

Open

Description

@rhettinger
BPO 17642
Nosy @rhettinger, @terryjreedy, @taleinat, @giampaolo, @serwy, @roseman, @rovitotv, @ZackerySpytz
PRs
  • gh-61842: Add hotkeys to resize IDLE's font #17107
  • Files
  • issue17642_patch.diff
  • ZoomInOut.patch
  • ZoomInOut.patch2
  • 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 = None
    created_at = <Date 2013-04-06.06:06:25.800>
    labels = ['expert-IDLE', 'type-feature', '3.8', '3.9']
    title = 'IDLE add font resizing hot keys and wheel'
    updated_at = <Date 2019-11-17.11:41:47.679>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2019-11-17.11:41:47.679>
    actor = 'taleinat'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2013-04-06.06:06:25.800>
    creator = 'rhettinger'
    dependencies = []
    files = ['30051', '30074', '30251']
    hgrepos = []
    issue_num = 17642
    keywords = ['patch']
    message_count = 18.0
    messages = ['186118', '186138', '186654', '188010', '188019', '188030', '188031', '188124', '188128', '189141', '189195', '226328', '273687', '273978', '273979', '350259', '350320', '356413']
    nosy_count = 12.0
    nosy_names = ['rhettinger', 'terry.reedy', 'taleinat', 'giampaolo.rodola', 'roger.serwy', 'markroseman', 'Todd.Rovito', 'python-dev', 'edmond.burnett', 'alex.rodas', 'Abhishek.Kumar', 'ZackerySpytz']
    pr_nums = ['17107']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue17642'
    versions = ['Python 3.8', 'Python 3.9']

    Activity

    1. rhettinger commented on Apr 6, 2013

      @rhettinger
      ContributorAuthor

      Add the standard hot keys for resizing fonts (i.e. on a Mac, CMD-plus and CMD-minus).

    2. serwy commented on Apr 6, 2013

      serwymannequin
      Mannequin

      IdleX provides this with the ZoomFont.py extension. (See http://idlex.sourceforge.net/extensions.html#Misc) It is useful for showing code on a projector so that students can easily read the screen.

      The implementation in ZoomFont.py does not change the font size found in IDLE's configuration. Instead it queries the font size in the text widget and scales accordingly with a relative offset.

      IDLE needs a better way to broadcast font configuration changes. Right now, the Code Context extension uses polling every second to check for font changes. I bring this point up because properly incorporating font zooming may require refactoring some code. Incorporating Line Numbers, from bpo-17535 would likely need to rely on this font size broadcasting as well.

    3. terryjreedy commented on Apr 12, 2013

      @terryjreedy
      Member

      On Windows, cntl-+. cntl--

      Could we use the tk event system by defining font change events and event handlers?

    4. alexrodas commented on Apr 28, 2013

      alexrodasmannequin
      Mannequin

      I have made a patch to zoom in and out with <Control-plus> and <Control-minus> events, respectively. I'll upload it soon since the test suite is giving me an error in test_multiprocessing, even before writing the patch.

      I have taken a look at ZoomFont.py of IdleX and it also has the option to reset the font size to its original value, but I don't know if this feature was wanted to be added too. However, ZoomFont controls the size of the LineNumber extension, while this patch only changes the font of the editview's text widget.

    5. AbhishekKumar commented on Apr 28, 2013

      AbhishekKumarmannequin
      Mannequin

      I have submitted a patch that is working fine on Windows and on Ubuntu. I have used ZoomFont.py of IdleX.

      On pressing Ctrl+ or Ctrl- it changes the user configuration and updates the font of all open windows as there is a common user configuration for all windows. I have removed polling from CodeContext instead I set font of CodeContext on every font change.

      As this is my first patch. Please review it and give your valuable feedback.

    6. alexrodas commented on Apr 28, 2013

      alexrodasmannequin
      Mannequin

      I have uploaded my patch as well, it doesn't make use of tkfont (just vanilla Tkinter methods) and it works both in Python 2.7 and 3.4 without the need of any import.

      I think the main difference with Abhishek Kumar's version is that mine does not use idleConf to retrieve and set the font size. However, the original ZoomFont.py of IdleX does not use it. Is it really necessary?

    7. alexrodas commented on Apr 28, 2013

      alexrodasmannequin
      Mannequin

      Sorry, I submitted a patch which only works on Windows. This one has been tested on Ubuntu too.

    8. serwy commented on Apr 30, 2013

      serwymannequin
      Mannequin

      Abhishek, Alejandro, welcome to IDLE development! If you can, please sign a contributor agreement.

      We have two patches to create this enhancement, both are good. I suggest that we figure out how to merge the solutions.

      The zoom-out binding should also include Ctrl-Equal, so that holding shift is no longer necessary. There's also a corner case where the zooming in on the editor may cause the cursor to go outside of viewing window.

      Using idleConf to query the font information is not strictly necessary since the font configuration in the text widget contains the font size already.

      In the future, please be careful with licensing. The top part of the ZoomFont.py extension places it under the NCSA license. Fortunately UIUC has allowed me to relicense parts IdleX for the Python Software Foundation.

    9. AbhishekKumar commented on Apr 30, 2013

      AbhishekKumarmannequin
      Mannequin

      Thanks Roger, for the feedback especially the licence part. I have least idea about licences but will take care in future.

      One question: Is it right to change IdleConf on Ctrl+ and Ctrl- ? I mean to change font for all open windows?
      It happens with most text editors but not with browsers.

      To remove those 2 hacks for CodeContext and LineNumbers, what we can do is write a ResetFont() for each extenstion and can call it from the ResetFont() of editor window like this:
      for extension in self.extensions:
      extension.ResetFont()
      so that we don't have to write seperate font-size hacks for each extension while resetting the font.

    10. alexrodas commented on May 13, 2013

      alexrodasmannequin
      Mannequin

      I have merged the two patches: Now it queries the font size as I did in the original patch, and it also stores the position of the cursor based on Abhishek Kumar's modification of ZoomFont.py.

    11. serwy commented on May 14, 2013

      serwymannequin
      Mannequin

      @abhishek: I'd rather not require extensions to have a new method for resetting font sizes. Instead, a virtual event can be bound to a callback by the extension if it needs to know about a font change.

      @alejandro: It looks like there's a bug in ZoomFont.py where the cursor can go off screen which has propagated into these patches. That's my fault.

      I'll take a look at these points later this week.

    12. 3 remaining items

    13. changed the title [-]IDLE add font resizing hot keys[/-] [+]IDLE add font resizing hot keys and wheel[/+] on Aug 25, 2016
    14. python-dev commented on Aug 31, 2016

      python-devmannequin
      Mannequin

      New changeset f478f9b88319 by Terry Jan Reedy in branch '2.7':
      Issue bpo-17642: add larger font sizes for classroom projection.
      https://hg.python.org/cpython/rev/f478f9b88319

      New changeset c9d59e6cc1e4 by Terry Jan Reedy in branch 'default':
      Issue bpo-17642: add larger font sizes for classroom projection.
      https://hg.python.org/cpython/rev/c9d59e6cc1e4

    15. terryjreedy commented on Aug 31, 2016

      @terryjreedy
      Member

      I intend to backport the simple list expansion to 3.5. Key or wheel patches will probably be 3.6 only.

    16. rhettinger commented on Aug 23, 2019

      @rhettinger
      ContributorAuthor

      Key or wheel patches will probably be 3.6 only.

      I still have hopes that this will happen.

      Am I correct in thinking that it wouldn't be difficult to map CMD-plus and CMD-minus (or for Windows Cntl-plus and Cntl-minus) to a function that increases or decreases the font-size without having to manually go to Preferences/FontsAndTabs?

    17. terryjreedy commented on Aug 23, 2019

      @terryjreedy
      Member

      I want this too, and part of it should be simple. Given that I have had a never empty backlog of PRs to review for 2 1/2 years, it got forgotten. There was also a tk problem that seemed to block implementation.

      Specification for hotkey: Cntl/Cmd - -+= decrease/increase font size within limits in the current window only. (The current limits for turtledemo are 6 and 100. Change this? The keys are fixed and cannot be customized. Keys have no affect on IdleConf. Setting font size in dialog continues to set font size for all Windows, whether individually set or not. Should work same for editor and text (read-only) windows.

      As near as I can tell, these key combinations currently do nothing. I presume they are not bound in the built-in keysets. Custom keysets are always subject to interference when we add new key bindings. (I don't know that the custom key dialog checks against such fixed builtins. Another issue. Checking custom keysets on import is likely a third issue.)

      Implementation for hotkey: The desired behavior is the behavior of turtledemo, so the same implementation should work. It is annoying that we need to add it separately for editor and text windows. But refactoring to create a common base class would be a lot harder.

      Mousewheel: Currently, in turtledemo, control-wheel changes size on all systems.

      Raymond: Should it be cmd-wheel on Mac?

      In msg226328 I reported a tk issue blocking both this and line numbers. We now deliver 3.7.4 and 3.8.0 with tk 8.6.9. We have line numbers because I no longer saw the glitchy behavior I remember. Nor did I see any issue with font resizing with turtledemo.

      I may include the module browser, etc, with this issue. Dialogs would be another issue.

    18. terryjreedy commented on Nov 12, 2019

      @terryjreedy
      Member

      bpo-33397 add a FontSizer class to textview.py and uses it there and for the doc viewer in help.py. It should be used for this issue also.

    19. transferred this issue fromon Apr 10, 2022
    20. moved this to In Progress in IDLE Issueson Jul 27, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions