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 — Tkinter getint(), getboolean() argument must be str, not tuple · Issue #118760 · python/cpython

Tkinter getint(), getboolean() argument must be str, not tuple #118760

New issue
Copy link
New issue
Copy link
Closed
Closed
Tkinter getint(), getboolean() argument must be str, not tuple#118760
Copy link
Labels
OS-windowsrelease-blockertopic-IDLEtopic-tkintertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@zooba
zooba
opened on May 8, 2024
Issue body actions

Bug report

Discovered during 3.13b1 release (we decided not to block the release over it, so this is just a known issue in b1):

While interacting with the config dialog in IDLE, I get these errors printed in the background.

Exception in Tkinter callback
Traceback (most recent call last):
  File "D:\cpython\Lib\tkinter\__init__.py", line 2064, in __call__
    args = self.subst(*args)
  File "D:\cpython\Lib\tkinter\__init__.py", line 1752, in _substitute
    e.state = getint_event(s)
              ~~~~~~~~~~~~^^^
  File "D:\cpython\Lib\tkinter\__init__.py", line 1726, in getint_event
    return getint(s)
TypeError: getint() argument must be str, not tuple

I suspect this is the underlying cause of these test failures, which were discovered in our final stage testing of the Windows release:

======================================================================
ERROR: test_highlight_target_text_mouse (idlelib.idle_test.test_configdialog.HighPageTest.test_highlight_target_text_mouse)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\b\Python\Lib\idlelib\idle_test\test_configdialog.py", line 447, in test_highlight_target_text_mouse
    eq(d.highlight_target.get(), elem[tag])
                                 ~~~~^^^^^
KeyError: 'sel'

======================================================================
FAIL: test_highlight_sample_b1_motion (idlelib.idle_test.test_configdialog.HighPageTest.test_highlight_sample_b1_motion)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\b\Python\Lib\idlelib\idle_test\test_configdialog.py", line 493, in test_highlight_sample_b1_motion
    eq(hs.tag_ranges('sel'), ())
    ~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (<string object: '1.0'>, <string object: '1.24'>) != ()

First tuple contains 2 additional elements.
First extra element 0:
<string object: '1.0'>

- (<string object: '1.0'>, <string object: '1.24'>)
+ ()

======================================================================
FAIL: test_highlight_sample_double_click (idlelib.idle_test.test_configdialog.HighPageTest.test_highlight_sample_double_click)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\b\Python\Lib\idlelib\idle_test\test_configdialog.py", line 471, in test_highlight_sample_double_click
    eq(hs.tag_ranges('sel'), ())
    ~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (<string object: '1.0'>, <string object: '1.24'>) != ()

First tuple contains 2 additional elements.
First extra element 0:
<string object: '1.0'>

- (<string object: '1.0'>, <string object: '1.24'>)
+ ()

----------------------------------------------------------------------

Possibly related to @serhiy-storchaka's recent changes?

Linked PRs

  • gh-118760: Fix errors in calling Tkinter bindings on Windows #118782
  • gh-118760: Restore the default value of tkinter.wantobjects to 1 #118784
  • [3.13] gh-118760: Fix errors in calling Tkinter bindings on Windows (GH-118782) #119072
  • [3.13] gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784) #119251

Activity

  1. zooba
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    OS-windows
    topic-tkinter
    topic-IDLE
    on May 8, 2024
  2. terryjreedy
    changed the title [-]Tkinter getint() argument must be str, not tuple[/-] [+]Tkinter getint(), getboolean() argument must be str, not tuple[/+] on May 8, 2024
  3. terryjreedy
    added
    release-blocker
    on May 8, 2024
  4. ezio-melotti
    added this to Release and Deferred blockers 🚫on May 8, 2024
  5. github-project-automation
    moved this to Todo in Release and Deferred blockers 🚫on May 8, 2024
  6. serhiy-storchaka commented on May 8, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on May 8, 2024
    Member
    More actions

    Yes, it is my fault.

  7. terryjreedy commented on May 8, 2024

    @terryjreedy
    terryjreedy
    on May 8, 2024
    Member
    More actions

    I see same test failures and errors in main and 3.13.0b1, not in 3.13.0a6. In main, I see geting error and also:

    Exception in Tkinter callback
    Traceback (most recent call last):
      File "F:\dev\3x\Lib\tkinter\__init__.py", line 2064, in __call__
        args = self.subst(*args)
      File "F:\dev\3x\Lib\tkinter\__init__.py", line 1758, in _substitute
        try: e.send_event = getboolean(E)
                            ~~~~~~~~~~^^^
    TypeError: getboolean() argument must be str, not tuple
    

    The Setting dialog Highlights page is unique in IDLE in having tag binding, which happen to be for left button clicks. Click on an element in the sample and the callback changes the label and background in the buttons above. The bug is that clicks after the first are often ignored, so that multiple clicks are required for one to be registered. At some point, a double click causes the sample box and the dialog to shrink in height by a half inch.

    Because not all clicks are ignored, users can managed if they think to keep trying. I expect this will affect other tkinter apps with tag bindings and think this should be blocker for next beta.

  8. serhiy-storchaka
    added a commit that references this issue on May 8, 2024

    pythongh-118760: Fix errors in calling Tkinter bindings on Windows

    6cf04f1
  9. serhiy-storchaka commented on May 8, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on May 8, 2024
    Member
    More actions

    It is a consequence of #98592.

    For unknown reasons some arguments are passed as a 1-tuple containing a Tcl_Obj with type "string" and value "0" what wantobjects is 2 (i.e. when they are not forcefully stringified). This happens only on Windows, and not always, running only the selected test is passed. I also tried to write tests for generated events (#118778), but they do not expose such weird behavior (perhaps for the same reason as it is not always reproducible in IDLE tests).

    I have two solutions for this. One -- fix the Event creation code where it fails. Two -- simply restore wantobjects = 1 by default (but keep experimental support for wantobjects = 2). I am going to apply both solutions.

  10. serhiy-storchaka
    added a commit that references this issue on May 8, 2024

    pythongh-118760: Restore the default value of tkiter.wantobjects to 1

    a65789b
  11. terryjreedy commented on May 8, 2024

    @terryjreedy
    terryjreedy
    on May 8, 2024
    Member
    More actions

    Opening Settings with Font tab default raises 2 getint errors. But non-default size is correct.

    Selecting Highlights and first click always works. First click after successful click always fails with getboolean error. Sometimes (>1/2?) next click also fails, with getboolean. This is the only random behavior I see. If failure, 3rd click seems to work. Selecting another tab and back to Highlights and first click works.

  12. serhiy-storchaka
    added a commit that references this issue on May 15, 2024

    gh-118760: Fix errors in calling Tkinter bindings on Windows (GH-118782)

    5b88d95
  13. miss-islington
    added a commit that references this issue on May 15, 2024

    pythongh-118760: Fix errors in calling Tkinter bindings on Windows (p…

    52505a4
  14. serhiy-storchaka commented on May 15, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on May 15, 2024
    Member
    More actions

    This may be due to the caching of the mutable Tcl_Obj in the Tcl core, so the string "2" may be interpreted differently depending on the interpretation of other strings "2" -- as a string, a number, a "pixel" object, or a list containing any of the listed.

  15. serhiy-storchaka
    added 2 commits that reference this issue on May 15, 2024

    [3.13] gh-118760: Fix errors in calling Tkinter bindings on Windows (G…

    4f81915

    gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-…

    e188527
  16. miss-islington
    added a commit that references this issue on May 20, 2024

    pythongh-118760: Restore the default value of tkinter.wantobjects to 1 (

    1b00598
  17. serhiy-storchaka
    added a commit that references this issue on May 20, 2024

    [3.13] gh-118760: Restore the default value of tkinter.wantobjects to…

    b4462aa
  18. encukou commented on May 21, 2024

    @encukou
    encukou
    on May 21, 2024
    Member
    More actions

    Can this be closed now?

  19. terryjreedy commented on May 21, 2024

    @terryjreedy
    terryjreedy
    on May 21, 2024
    Member
    More actions

    IDLE and test_idle work fine for me now.

  20. zooba commented on May 21, 2024

    @zooba
    zooba
    on May 21, 2024
    MemberAuthor
    More actions

    I don't know that I can confirm fully until we do the next release, as the test that failed was the one that tests the installer after it's produced. But we can easily bypass the tests again if they fail next time, so no further need to keep this open IMHO.

  21. zooba
    closed this as completedon May 21, 2024
  22. github-project-automation
    moved this from Todo to Done in Release and Deferred blockers 🚫on May 21, 2024
  23. estyxx
    added 2 commits that reference this issue on Jul 17, 2024

    pythongh-118760: Fix errors in calling Tkinter bindings on Windows (p…

    749711c

    pythongh-118760: Restore the default value of tkinter.wantobjects to 1 (

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsrelease-blockertopic-IDLEtopic-tkintertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Release and Deferred blockers 🚫
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — 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.