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 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.
This commit is contained in:
Serhiy Storchaka 2014-01-07 19:27:42 +02:00
parent 0455c3fd28
commit a21acb5d95
7 changed files with 153 additions and 71 deletions

View file

@ -1459,11 +1459,11 @@ class Misc:
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:
@ -1577,7 +1577,11 @@ class Wm:
if len(wlist) > 1:
wlist = (wlist,) # Tk needs a list of windows here
args = ('wm', 'colormapwindows', self._w) + wlist
return [self._nametowidget(x) for x in self.tk.call(args)]
if wlist:
self.tk.call(args)
else:
return [self._nametowidget(x)
for x in 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
@ -3472,8 +3476,11 @@ class BitmapImage(Image):
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):
@ -3842,7 +3849,7 @@ class PanedWindow(Widget):
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: