Issue #20072: Fixed multiple errors in tkinter with wantobjects is False.
* Misc.image_names(), Misc.image_types(), Wm.wm_colormapwindows(), and
LabelFrame.panes() now always return a tuple.
* Fixed _stringify() for non-ASCII strings.
* Fixed error of comparing str and int in tt.LabeledScale._adjust().
* ttk.Notebook.index() now always returns int.
* ttk.Notebook.tabs() now always returns a tuple.
* ttk.Entry.bbox() now always returns a tuple of ints.
* ttk.Entry.validate() now always correctly works.
* ttk.Combobox.current() now always returns int.
* ttk.Panedwindow.sashpos() now always returns int.
* ttk.Treeview.bbox() now always returns a tuple of ints.
* ttk.Treeview.get_children() now always returns a tuple.
* ttk.Treeview.exists() now always correctly works.
* ttk.Treeview.index() now always returns int.
* ttk.Treeview.tag_has() now always returns 0 or 1.
* And numerous other errors in methods which returns a tuple, list or dict.
* Fixed ttk tests for wantobjects is False.
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 700f6bb..0da6cfc 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -76,9 +76,9 @@
else:
value = '{%s}' % _join(value)
else:
- if isinstance(value, basestring):
- value = unicode(value)
- else:
+ if isinstance(value, str):
+ value = unicode(value, 'utf-8')
+ elif not isinstance(value, unicode):
value = str(value)
if not value:
value = '{}'
@@ -1456,11 +1456,11 @@
def image_names(self):
"""Return a list of all existing image names."""
- return self.tk.call('image', 'names')
+ return self.tk.splitlist(self.tk.call('image', 'names'))
def image_types(self):
"""Return a list of all available image types (e.g. phote bitmap)."""
- return self.tk.call('image', 'types')
+ return self.tk.splitlist(self.tk.call('image', 'types'))
class CallWrapper:
@@ -1574,7 +1574,10 @@
if len(wlist) > 1:
wlist = (wlist,) # Tk needs a list of windows here
args = ('wm', 'colormapwindows', self._w) + wlist
- return map(self._nametowidget, self.tk.call(args))
+ if wlist:
+ self.tk.call(args)
+ else:
+ return map(self._nametowidget, self.tk.splitlist(self.tk.call(args)))
colormapwindows = wm_colormapwindows
def wm_command(self, value=None):
"""Store VALUE in WM_COMMAND property. It is the command
@@ -3374,8 +3377,11 @@
Valid resource names: background, data, file, foreground, maskdata, maskfile."""
Image.__init__(self, 'bitmap', name, cnf, master, **kw)
-def image_names(): return _default_root.tk.call('image', 'names')
-def image_types(): return _default_root.tk.call('image', 'types')
+def image_names():
+ return _default_root.tk.splitlist(_default_root.tk.call('image', 'names'))
+
+def image_types():
+ return _default_root.tk.splitlist(_default_root.tk.call('image', 'types'))
class Spinbox(Widget, XView):
@@ -3744,7 +3750,7 @@
def panes(self):
"""Returns an ordered list of the child panes."""
- return self.tk.call(self._w, 'panes')
+ return self.tk.splitlist(self.tk.call(self._w, 'panes'))
######################################################################
# Extensions: