GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — wm_attributes doesn't take keyword arguments · Issue #43457 · python/cpython

wm_attributes doesn't take keyword arguments #43457

New issue
Copy link
New issue
Copy link
Closed
Closed
wm_attributes doesn't take keyword arguments#43457
Copy link
Assignees
serhiy-storchakaloewis
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancementA feature request or enhancement

Description

gregcouch
mannequin
opened on Jun 5, 2006
Issue body actions
BPO 1500773
Nosy @loewis, @asvetlov
Files
  • Tkinter.patch: wm_attributes patch
  • issue1500773.diff
  • 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/loewis'
    closed_at = None
    created_at = <Date 2006-06-05.06:35:26.000>
    labels = ['type-feature', 'expert-tkinter']
    title = "wm_attributes doesn't take keyword arguments"
    updated_at = <Date 2012-03-21.19:45:52.695>
    user = 'https://bugs.python.org/gregcouch'

    bugs.python.org fields:

    activity = <Date 2012-03-21.19:45:52.695>
    actor = 'asvetlov'
    assignee = 'loewis'
    closed = False
    closed_date = None
    closer = None
    components = ['Tkinter']
    creation = <Date 2006-06-05.06:35:26.000>
    creator = 'gregcouch'
    dependencies = []
    files = ['7311', '10548']
    hgrepos = []
    issue_num = 1500773
    keywords = ['patch']
    message_count = 4.0
    messages = ['50427', '50428', '50429', '67668']
    nosy_count = 5.0
    nosy_names = ['loewis', 'gregcouch', 'klappnase', 'gpolo', 'asvetlov']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1500773'
    versions = ['Python 3.2']

    Linked PRs

    • gh-43457: Tkinter: fix design flaws in wm_attributes() #111404

    Activity

    1. gregcouch commented on Jun 5, 2006

      @gregcouch
      gregcouchmannequin
      on Jun 5, 2006
      MannequinAuthor
      More actions

      The Tk wm attributes command takes option arguments
      (from the Tk wm manual page):

         wm attributes window ?option value option value...?

      And option arguments are normally given with keyword
      arguments in Tkinter (most if not all widget creation
      functions and widget commands). The attached patch
      changes the wm_attributes method to take keyword
      arguments, so top.wm_attributes(alpha=.8) will work as
      expected (on Windows XP and Mac OS X).

    2. gregcouch
      assigned
      loewis
      on Jun 5, 2006
    3. gregcouch
      added
      topic-tkinter
      on Jun 5, 2006
    4. gregcouch
      assigned
      loewis
      on Jun 5, 2006
    5. gregcouch
      added
      topic-tkinter
      on Jun 5, 2006
    6. loewis commented on Jun 17, 2006

      @loewis
      loewismannequin
      on Jun 17, 2006
      Mannequin
      More actions

      Logged In: YES
      user_id=21627

      This is an incompatible change. I also don't see the point;

      top.wm_attributes('alpha',.8)

      should work just fine, no?

    7. klappnase commented on Jul 20, 2006

      @klappnase
      klappnasemannequin
      on Jul 20, 2006
      Mannequin
      More actions

      Logged In: YES
      user_id=797929

      I do not have winXP or OSX available to actually test it,
      but I doubt that

          top.wm_attributes('alpha',.8)

      will work; from Tk documentation it looks like you will have
      to write

          top.wm_attributes('-alpha',.8)

      which is in fact not what one would expect.
      Maybe a better solution than Greg's patch was to change
      wm_attributes() to accept both ways, like:

      def wm_attributes(self, *args, **kw):
          args = ('wm', 'attributes', self._w) + args +
      self._options({}, kw)
          return self.tk.call(args)

      so that old code will not break and the more intuitive
      version that Greg suggested is also legal.

    8. gpolo commented on Jun 3, 2008

      @gpolo
      gpolomannequin
      on Jun 3, 2008
      Mannequin
      More actions

      I'm adding my own version, this was done against python-trunk

    9. devdanzin
      added
      type-featureA feature request or enhancementA feature request or enhancement
      on Mar 21, 2009
    10. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    11. serhiy-storchaka
      added a commit that references this issue on Oct 27, 2023

      pythongh-43457: Tkinter: fix design flaws in wm_attributes()

      6cbe488
    12. serhiy-storchaka commented on Oct 27, 2023

      @serhiy-storchaka
      serhiy-storchaka
      on Oct 27, 2023
      Member
      More actions

      The proposed PR contains the following changes:

      1. w.wm_attributes() without arguments returns a dict instead of a tuple or a str.
        E.g. it returns {'alpha': 1.0, 'topmost': 0, 'zoomed': 0, 'fullscreen': 0, 'type': ''} instead of ('-alpha', 1.0, '-topmost', 0, '-zoomed', 0, '-fullscreen', 0, '-type', ''), and, when wantobjects is 0, it returns {'alpha': '1.0', 'topmost': '0', 'zoomed': '0', 'fullscreen': '0', 'type': ''} instead of '-alpha 1.0 -topmost 0 -zoomed 0 -fullscreen 0 -type {}'.
        This is a breaking change!
        You still can get the old result when pass None as argument: w.wm_attributes(None).
      2. When called with a single argument to get a value, it allow to omit the minus prefix. E.g. w.wm_attributes('alpha'). w.wm_attributes('-alpha') also supported, but is now silently deprecated.
      3. It can be called with keyword arguments to set attributes. E.g. w.wm_attributes(alpha=0.5). Old way w.wm_attributes('-alpha', 0.5) also works, but it is now silently deprecated.
    13. serhiy-storchaka
      self-assigned this
      on Oct 27, 2023
    14. serhiy-storchaka commented on Oct 28, 2023

      @serhiy-storchaka
      serhiy-storchaka
      on Oct 28, 2023
      Member
      More actions

      Opened a discussion https://discuss.python.org/t/tkinter-wm-attributes-needs-breaking-changes/37360.

    15. serhiy-storchaka commented on Nov 14, 2023

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 14, 2023
      Member
      More actions

      My request for unconditional changing the returned value was rejected: python/steering-council#211. Instead it was proposed to add an optional argument return_python_dict=False.

    16. iritkatriel
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Nov 23, 2023
    17. serhiy-storchaka
      added a commit that references this issue on Feb 5, 2024

      gh-43457: Tkinter: fix design flaws in wm_attributes() (GH-111404)

      b4ba0f7
    18. serhiy-storchaka
      closed this as completedon Feb 5, 2024
    19. fsc-eriker
      added a commit that references this issue on Feb 14, 2024

      pythongh-43457: Tkinter: fix design flaws in wm_attributes() (pythonG…

      902d5db
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • loewis
    • @serhiy-storchaka
      serhiy-storchaka

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.