mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Issue #20636: Improved the repr of Tkinter widgets.
This commit is contained in:
parent
578c9211d6
commit
bcc174615c
4 changed files with 13 additions and 1 deletions
|
|
@ -1879,7 +1879,7 @@ Settings and special methods
|
||||||
|
|
||||||
>>> cv = screen.getcanvas()
|
>>> cv = screen.getcanvas()
|
||||||
>>> cv
|
>>> cv
|
||||||
<turtle.ScrolledCanvas object at ...>
|
<turtle.ScrolledCanvas object ...>
|
||||||
|
|
||||||
|
|
||||||
.. function:: getshapes()
|
.. function:: getshapes()
|
||||||
|
|
|
||||||
|
|
@ -1280,6 +1280,11 @@ class Misc:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Return the window path name of this widget."""
|
"""Return the window path name of this widget."""
|
||||||
return self._w
|
return self._w
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '<%s.%s object %s>' % (
|
||||||
|
self.__class__.__module__, self.__class__.__qualname__, self._w)
|
||||||
|
|
||||||
# Pack methods that apply to the master
|
# Pack methods that apply to the master
|
||||||
_noarg_ = ['_noarg_']
|
_noarg_ = ['_noarg_']
|
||||||
def pack_propagate(self, flag=_noarg_):
|
def pack_propagate(self, flag=_noarg_):
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,11 @@ class MiscTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.root = ttk.setup_master()
|
self.root = ttk.setup_master()
|
||||||
|
|
||||||
|
def test_repr(self):
|
||||||
|
t = tkinter.Toplevel(self.root, name='top')
|
||||||
|
f = tkinter.Frame(t, name='child')
|
||||||
|
self.assertEqual(repr(f), '<tkinter.Frame object .top.child>')
|
||||||
|
|
||||||
def test_tk_setPalette(self):
|
def test_tk_setPalette(self):
|
||||||
root = self.root
|
root = self.root
|
||||||
root.tk_setPalette('black')
|
root.tk_setPalette('black')
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #20636: Improved the repr of Tkinter widgets.
|
||||||
|
|
||||||
- Issue #19505: The items, keys, and values views of OrderedDict now support
|
- Issue #19505: The items, keys, and values views of OrderedDict now support
|
||||||
reverse iteration using reversed().
|
reverse iteration using reversed().
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue