Skip to content

Tkinter ttk widgets cget() returning _tkinter.Tcl_Obj instead of str #126008

Open
@maj113

Description

@maj113

The docstring: """Return the resource value for a KEY given as string.""" claims it returns as a string however it returns a _tkinter.Tcl_Obj
which seems to lack __eq__/the ability to compare it to a string so something like this:

is_normal = radio_button.cget("state") == tk.NORMAL

Will always return false no matter what unless its wrapped in a str()

I propose either clarifying the docstr or returning as a str() wrapped obj but i presume that's a breaking change

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions