Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Lib/tkinter/ttk.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"tclobjs_to_py", "setup_master"]

import tkinter
import _tkinter
from tkinter import _flatten, _join, _stringify, _splitdict


Expand Down Expand Up @@ -570,6 +571,15 @@ def state(self, statespec=None):
return self.tk.splitlist(str(self.tk.call(self._w, "state", statespec)))


def cget(self, key):
"""Return the resource value for a KEY given as string."""
if isinstance(return_value := super().cget(key), _tkinter.Tcl_Obj):
return str(return_value)
return return_value

__getitem__ = cget


class Button(Widget):
"""Ttk Button widget, displays a textual label and/or image, and
evaluates a command when pressed."""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix an incorrect return value type when getting resource value of ttk widgets.
Loading