diff options
Diffstat (limited to 'Lib/tkinter')
-rw-r--r-- | Lib/tkinter/__init__.py | 139 | ||||
-rw-r--r-- | Lib/tkinter/__main__.py | 7 | ||||
-rw-r--r-- | Lib/tkinter/font.py | 2 | ||||
-rw-r--r-- | Lib/tkinter/scrolledtext.py | 7 | ||||
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_font.py | 33 | ||||
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_loadtk.py | 3 | ||||
-rw-r--r-- | Lib/tkinter/test/test_ttk/test_widgets.py | 4 | ||||
-rw-r--r-- | Lib/tkinter/tix.py | 175 | ||||
-rw-r--r-- | Lib/tkinter/ttk.py | 12 |
9 files changed, 225 insertions, 157 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 0bccbfc..e54c53f 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -1403,6 +1403,48 @@ class CallWrapper: self.widget._report_exception() +class XView: + """Mix-in class for querying and changing the horizontal position + of a widget's window.""" + + def xview(self, *args): + """Query and change the horizontal position of the view.""" + res = self.tk.call(self._w, 'xview', *args) + if not args: + return self._getdoubles(res) + + def xview_moveto(self, fraction): + """Adjusts the view in the window so that FRACTION of the + total width of the canvas is off-screen to the left.""" + self.tk.call(self._w, 'xview', 'moveto', fraction) + + def xview_scroll(self, number, what): + """Shift the x-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" + self.tk.call(self._w, 'xview', 'scroll', number, what) + + +class YView: + """Mix-in class for querying and changing the vertical position + of a widget's window.""" + + def yview(self, *args): + """Query and change the vertical position of the view.""" + res = self.tk.call(self._w, 'yview', *args) + if not args: + return self._getdoubles(res) + + def yview_moveto(self, fraction): + """Adjusts the view in the window so that FRACTION of the + total height of the canvas is off-screen to the top.""" + self.tk.call(self._w, 'yview', 'moveto', fraction) + + def yview_scroll(self, number, what): + """Shift the y-view according to NUMBER which is measured in + "units" or "pages" (WHAT).""" + self.tk.call(self._w, 'yview', 'scroll', number, what) + + class Wm: """Provides functions for the communication with the window manager.""" @@ -2041,7 +2083,7 @@ def At(x, y=None): else: return '@%r,%r' % (x, y) -class Canvas(Widget): +class Canvas(Widget, XView, YView): """Canvas widget to display graphical elements like lines or text.""" def __init__(self, master=None, cnf={}, **kw): """Construct a canvas widget with the parent MASTER. @@ -2281,30 +2323,6 @@ class Canvas(Widget): def type(self, tagOrId): """Return the type of the item TAGORID.""" return self.tk.call(self._w, 'type', tagOrId) or None - def xview(self, *args): - """Query and change horizontal position of the view.""" - if not args: - return self._getdoubles(self.tk.call(self._w, 'xview')) - self.tk.call((self._w, 'xview') + args) - def xview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total width of the canvas is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) - def yview(self, *args): - """Query and change vertical position of the view.""" - if not args: - return self._getdoubles(self.tk.call(self._w, 'yview')) - self.tk.call((self._w, 'yview') + args) - def yview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total height of the canvas is off-screen to the top.""" - self.tk.call(self._w, 'yview', 'moveto', fraction) - def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'yview', 'scroll', number, what) class Checkbutton(Widget): """Checkbutton widget which is either in on- or off-state.""" @@ -2335,7 +2353,7 @@ class Checkbutton(Widget): """Toggle the button.""" self.tk.call(self._w, 'toggle') -class Entry(Widget): +class Entry(Widget, XView): """Entry widget which allows to display simple text.""" def __init__(self, master=None, cnf={}, **kw): """Construct an entry widget with the parent MASTER. @@ -2386,7 +2404,8 @@ class Entry(Widget): self.tk.call(self._w, 'selection', 'from', index) select_from = selection_from def selection_present(self): - """Return whether the widget has the selection.""" + """Return True if there are characters selected in the entry, False + otherwise.""" return self.tk.getboolean( self.tk.call(self._w, 'selection', 'present')) select_present = selection_present @@ -2398,16 +2417,6 @@ class Entry(Widget): """Set the variable end of a selection to INDEX.""" self.tk.call(self._w, 'selection', 'to', index) select_to = selection_to - def xview(self, index): - """Query and change horizontal position of the view.""" - self.tk.call(self._w, 'xview', index) - def xview_moveto(self, fraction): - """Adjust the view in the window so that FRACTION of the - total width of the entry is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) class Frame(Widget): """Frame widget which may contain other widgets and can have a 3D border.""" @@ -2449,7 +2458,7 @@ class Label(Widget): """ Widget.__init__(self, master, 'label', cnf, kw) -class Listbox(Widget): +class Listbox(Widget, XView, YView): """Listbox widget which can display a list of strings.""" def __init__(self, master=None, cnf={}, **kw): """Construct a listbox widget with the parent MASTER. @@ -2528,30 +2537,6 @@ class Listbox(Widget): def size(self): """Return the number of elements in the listbox.""" return getint(self.tk.call(self._w, 'size')) - def xview(self, *what): - """Query and change horizontal position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'xview')) - self.tk.call((self._w, 'xview') + what) - def xview_moveto(self, fraction): - """Adjust the view in the window so that FRACTION of the - total width of the entry is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) - def yview(self, *what): - """Query and change vertical position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'yview')) - self.tk.call((self._w, 'yview') + what) - def yview_moveto(self, fraction): - """Adjust the view in the window so that FRACTION of the - total width of the entry is off-screen to the top.""" - self.tk.call(self._w, 'yview', 'moveto', fraction) - def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'yview', 'scroll', number, what) def itemcget(self, index, option): """Return the resource value for an ITEM and an OPTION.""" return self.tk.call( @@ -2798,7 +2783,7 @@ class Scrollbar(Widget): -class Text(Widget): +class Text(Widget, XView, YView): """Text widget which can display text in various forms.""" def __init__(self, master=None, cnf={}, **kw): """Construct a text widget with the parent MASTER. @@ -3120,32 +3105,6 @@ class Text(Widget): """Return all names of embedded windows in this widget.""" return self.tk.splitlist( self.tk.call(self._w, 'window', 'names')) - def xview(self, *what): - """Query and change horizontal position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'xview')) - self.tk.call((self._w, 'xview') + what) - def xview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total width of the canvas is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured - in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) - def yview(self, *what): - """Query and change vertical position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'yview')) - self.tk.call((self._w, 'yview') + what) - def yview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total height of the canvas is off-screen to the top.""" - self.tk.call(self._w, 'yview', 'moveto', fraction) - def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured - in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'yview', 'scroll', number, what) def yview_pickplace(self, *what): """Obsolete function, use see.""" self.tk.call((self._w, 'yview', '-pickplace') + what) @@ -3331,7 +3290,7 @@ def image_names(): return _default_root.tk.call('image', 'names') def image_types(): return _default_root.tk.call('image', 'types') -class Spinbox(Widget): +class Spinbox(Widget, XView): """spinbox widget.""" def __init__(self, master=None, cnf={}, **kw): """Construct a spinbox widget with the parent MASTER. diff --git a/Lib/tkinter/__main__.py b/Lib/tkinter/__main__.py new file mode 100644 index 0000000..757880d --- /dev/null +++ b/Lib/tkinter/__main__.py @@ -0,0 +1,7 @@ +"""Main entry point""" + +import sys +if sys.argv[0].endswith("__main__.py"): + sys.argv[0] = "python -m tkinter" +from . import _test as main +main() diff --git a/Lib/tkinter/font.py b/Lib/tkinter/font.py index 1ec760e..5425b06 100644 --- a/Lib/tkinter/font.py +++ b/Lib/tkinter/font.py @@ -97,7 +97,7 @@ class Font: return self.name def __eq__(self, other): - return self.name == other.name and isinstance(other, Font) + return isinstance(other, Font) and self.name == other.name def __getitem__(self, key): return self.cget(key) diff --git a/Lib/tkinter/scrolledtext.py b/Lib/tkinter/scrolledtext.py index d9af67c..9aa936a 100644 --- a/Lib/tkinter/scrolledtext.py +++ b/Lib/tkinter/scrolledtext.py @@ -27,8 +27,11 @@ class ScrolledText(Text): self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview - # Copy geometry methods of self.frame -- hack! - methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys() + # Copy geometry methods of self.frame without overriding Text + # methods -- hack! + text_meths = vars(Text).keys() + methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys() + methods = methods.difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': diff --git a/Lib/tkinter/test/test_tkinter/test_font.py b/Lib/tkinter/test/test_tkinter/test_font.py new file mode 100644 index 0000000..dfd630b --- /dev/null +++ b/Lib/tkinter/test/test_tkinter/test_font.py @@ -0,0 +1,33 @@ +import unittest +import tkinter +from tkinter import font +from test.support import requires, run_unittest +import tkinter.test.support as support + +requires('gui') + +class FontTest(unittest.TestCase): + + def setUp(self): + support.root_deiconify() + + def tearDown(self): + support.root_withdraw() + + def test_font_eq(self): + fontname = "TkDefaultFont" + try: + f = font.Font(name=fontname, exists=True) + except tkinter._tkinter.TclError: + f = font.Font(name=fontname, exists=False) + font1 = font.nametofont(fontname) + font2 = font.nametofont(fontname) + self.assertIsNot(font1, font2) + self.assertEqual(font1, font2) + self.assertNotEqual(font1, font1.copy()) + self.assertNotEqual(font1, 0) + +tests_gui = (FontTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) diff --git a/Lib/tkinter/test/test_tkinter/test_loadtk.py b/Lib/tkinter/test/test_tkinter/test_loadtk.py index 8f1a085..bab7bcd 100644 --- a/Lib/tkinter/test/test_tkinter/test_loadtk.py +++ b/Lib/tkinter/test/test_tkinter/test_loadtk.py @@ -31,7 +31,8 @@ class TkLoadTest(unittest.TestCase): # doesn't actually carry through to the process level # because they don't support unsetenv # If that's the case, abort. - display = os.popen('echo $DISPLAY').read().strip() + with os.popen('echo $DISPLAY') as pipe: + display = pipe.read().strip() if display: return diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py index 35824ea..cd00a61 100644 --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1,5 +1,6 @@ import unittest import tkinter +import os from tkinter import ttk from test.support import requires, run_unittest @@ -925,7 +926,8 @@ class TreeviewTest(unittest.TestCase): self.assertRaises(tkinter.TclError, self.tv.heading, '#0', anchor=1) - + # XXX skipping for now; should be fixed to work with newer ttk + @unittest.skip def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py index 6458797..17ed230 100644 --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -46,6 +46,21 @@ BALLOON = 'balloon' AUTO = 'auto' ACROSSTOP = 'acrosstop' +# A few useful constants for the Grid widget +ASCII = 'ascii' +CELL = 'cell' +COLUMN = 'column' +DECREASING = 'decreasing' +INCREASING = 'increasing' +INTEGER = 'integer' +MAIN = 'main' +MAX = 'max' +REAL = 'real' +ROW = 'row' +S_REGION = 's-region' +X_REGION = 'x-region' +Y_REGION = 'y-region' + # Some constants used by Tkinter dooneevent() TCL_DONT_WAIT = 1 << 1 TCL_WINDOW_EVENTS = 1 << 2 @@ -850,7 +865,7 @@ class FileEntry(TixWidget): # FIXME: return python object pass -class HList(TixWidget): +class HList(TixWidget, XView, YView): """HList - Hierarchy display widget can be used to display any data that have a hierarchical structure, for example, file system directory trees. The list entries are indented and connected by branch lines @@ -961,6 +976,10 @@ class HList(TixWidget): def info_anchor(self): return self.tk.call(self._w, 'info', 'anchor') + def info_bbox(self, entry): + return self._getints( + self.tk.call(self._w, 'info', 'bbox', entry)) or None + def info_children(self, entry=None): c = self.tk.call(self._w, 'info', 'children', entry) return self.tk.splitlist(c) @@ -968,6 +987,12 @@ class HList(TixWidget): def info_data(self, entry): return self.tk.call(self._w, 'info', 'data', entry) + def info_dragsite(self): + return self.tk.call(self._w, 'info', 'dragsite') + + def info_dropsite(self): + return self.tk.call(self._w, 'info', 'dropsite') + def info_exists(self, entry): return self.tk.call(self._w, 'info', 'exists', entry) @@ -1037,12 +1062,6 @@ class HList(TixWidget): def show_entry(self, entry): return self.tk.call(self._w, 'show', 'entry', entry) - def xview(self, *args): - self.tk.call(self._w, 'xview', *args) - - def yview(self, *args): - self.tk.call(self._w, 'yview', *args) - class InputOnly(TixWidget): """InputOnly - Invisible widget. Unix only. @@ -1241,11 +1260,8 @@ class PanedWindow(TixWidget): self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw)) def panes(self): - names = self.tk.call(self._w, 'panes') - ret = [] - for x in names: - ret.append(self.subwidget(x)) - return ret + names = self.tk.splitlist(self.tk.call(self._w, 'panes')) + return [self.subwidget(x) for x in names] class PopupMenu(TixWidget): """PopupMenu widget can be used as a replacement of the tk_popup command. @@ -1419,7 +1435,7 @@ class StdButtonBox(TixWidget): if name in self.subwidget_list: self.tk.call(self._w, 'invoke', name) -class TList(TixWidget): +class TList(TixWidget, XView, YView): """TList - Hierarchy display widget which can be used to display data in a tabular format. The list entries of a TList widget are similar to the entries in the Tk listbox widget. The main @@ -1502,12 +1518,6 @@ class TList(TixWidget): def selection_set(self, first, last=None): self.tk.call(self._w, 'selection', 'set', first, last) - def xview(self, *args): - self.tk.call(self._w, 'xview', *args) - - def yview(self, *args): - self.tk.call(self._w, 'yview', *args) - class Tree(TixWidget): """Tree - The tixTree widget can be used to display hierachical data in a tree form. The user can adjust @@ -1563,7 +1573,7 @@ class CheckList(TixWidget): # FIXME: It should inherit -superclass tixTree def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixCheckList', - ['options'], cnf, kw) + ['options', 'radio'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') @@ -1777,7 +1787,7 @@ class CObjView(TixWidget): pass -class Grid(TixWidget): +class Grid(TixWidget, XView, YView): '''The Tix Grid command creates a new window and makes it into a tixGrid widget. Additional options, may be specified on the command line or in the option database to configure aspects such as its cursor @@ -1801,16 +1811,21 @@ class Grid(TixWidget): TixWidget.__init__(self, master, 'tixGrid', static, cnf, kw) # valid options as of Tk 8.4 - # anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget, edit - # entryconfigure, format, geometryinfo, info, index, move, nearest, selection - # set, size, unset, xview, yview - # def anchor option ?args ...? + # anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget, + # edit, entryconfigure, format, geometryinfo, info, index, move, nearest, + # selection, set, size, unset, xview, yview + def anchor_clear(self): + """Removes the selection anchor.""" + self.tk.call(self, 'anchor', 'clear') + def anchor_get(self): "Get the (x,y) coordinate of the current anchor cell" return self._getints(self.tk.call(self, 'anchor', 'get')) - # def bdtype - # def delete dim from ?to? + def anchor_set(self, x, y): + """Set the selection anchor to the cell at (x, y).""" + self.tk.call(self, 'anchor', 'set', x, y) + def delete_row(self, from_, to=None): """Delete rows between from_ and to inclusive. If to is not provided, delete only row at from_""" @@ -1818,6 +1833,7 @@ class Grid(TixWidget): self.tk.call(self, 'delete', 'row', from_) else: self.tk.call(self, 'delete', 'row', from_, to) + def delete_column(self, from_, to=None): """Delete columns between from_ and to inclusive. If to is not provided, delete only column at from_""" @@ -1825,26 +1841,49 @@ class Grid(TixWidget): self.tk.call(self, 'delete', 'column', from_) else: self.tk.call(self, 'delete', 'column', from_, to) - # def edit apply - # def edit set x y + + def edit_apply(self): + """If any cell is being edited, de-highlight the cell and applies + the changes.""" + self.tk.call(self, 'edit', 'apply') + + def edit_set(self, x, y): + """Highlights the cell at (x, y) for editing, if the -editnotify + command returns True for this cell.""" + self.tk.call(self, 'edit', 'set', x, y) def entrycget(self, x, y, option): "Get the option value for cell at (x,y)" + if option and option[0] != '-': + option = '-' + option return self.tk.call(self, 'entrycget', x, y, option) - def entryconfigure(self, x, y, **kw): - return self.tk.call(self, 'entryconfigure', x, y, *self._options(None, kw)) + def entryconfigure(self, x, y, cnf=None, **kw): + return self._configure(('entryconfigure', x, y), cnf, kw) + # def format # def index def info_exists(self, x, y): "Return True if display item exists at (x,y)" - return bool(int(self.tk.call(self, 'info', 'exists', x, y))) + return self._getboolean(self.tk.call(self, 'info', 'exists', x, y)) def info_bbox(self, x, y): # This seems to always return '', at least for 'text' displayitems return self.tk.call(self, 'info', 'bbox', x, y) + def move_column(self, from_, to, offset): + """Moves the the range of columns from position FROM through TO by + the distance indicated by OFFSET. For example, move_column(2, 4, 1) + moves the columns 2,3,4 to columns 3,4,5.""" + self.tk.call(self, 'move', 'column', from_, to, offset) + + def move_row(self, from_, to, offset): + """Moves the the range of rows from position FROM through TO by + the distance indicated by OFFSET. + For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5.""" + self.tk.call(self, 'move', 'row', from_, to, offset) + def nearest(self, x, y): "Return coordinate of cell nearest pixel coordinate (x,y)" return self._getints(self.tk.call(self, 'nearest', x, y)) @@ -1854,7 +1893,6 @@ class Grid(TixWidget): # def selection includes # def selection set # def selection toggle - # def move dim from to offset def set(self, x, y, itemtype=None, **kw): args= self._options(self.cnf, kw) @@ -1862,24 +1900,59 @@ class Grid(TixWidget): args= ('-itemtype', itemtype) + args self.tk.call(self, 'set', x, y, *args) - # def size dim index ?option value ...? - # def unset x y - - def xview(self): - return self._getdoubles(self.tk.call(self, 'xview')) - def xview_moveto(self, fraction): - self.tk.call(self,'xview', 'moveto', fraction) - def xview_scroll(self, count, what="units"): - "Scroll right (count>0) or left <count> of units|pages" - self.tk.call(self, 'xview', 'scroll', count, what) - - def yview(self): - return self._getdoubles(self.tk.call(self, 'yview')) - def yview_moveto(self, fraction): - self.tk.call(self,'ysview', 'moveto', fraction) - def yview_scroll(self, count, what="units"): - "Scroll down (count>0) or up <count> of units|pages" - self.tk.call(self, 'yview', 'scroll', count, what) + def size_column(self, index, **kw): + """Queries or sets the size of the column given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given column. + INDEX can also be the string "default"; in this case, this command + queries or sets the default size of all columns. + When no option-value pair is given, this command returns a tuple + containing the current size setting of the given column. When + option-value pairs are given, the corresponding options of the + size setting of the given column are changed. Options may be one + of the follwing: + pad0 pixels + Specifies the paddings to the left of a column. + pad1 pixels + Specifies the paddings to the right of a column. + size val + Specifies the width of a column . + Val may be: "auto" -- the width of the column is set the + the widest cell in the column; a valid Tk screen distance + unit; or a real number following by the word chars + (e.g. 3.4chars) that sets the width of the column to the + given number of characters.""" + return self.tk.split(self.tk.call(self._w, 'size', 'column', index, + *self._options({}, kw))) + + def size_row(self, index, **kw): + """Queries or sets the size of the row given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given row . + INDEX can also be the string "default"; in this case, this command + queries or sets the default size of all rows. + When no option-value pair is given, this command returns a list con- + taining the current size setting of the given row . When option-value + pairs are given, the corresponding options of the size setting of the + given row are changed. Options may be one of the follwing: + pad0 pixels + Specifies the paddings to the top of a row. + pad1 pixels + Specifies the paddings to the the bottom of a row. + size val + Specifies the height of a row. + Val may be: "auto" -- the height of the row is set the + the highest cell in the row; a valid Tk screen distance + unit; or a real number following by the word chars + (e.g. 3.4chars) that sets the height of the row to the + given number of characters.""" + return self.tk.split(self.tk.call( + self, 'size', 'row', index, *self._options({}, kw))) + + def unset(self, x, y): + """Clears the cell at (x, y) by removing its display item.""" + self.tk.call(self._w, 'unset', x, y) + class ScrolledGrid(Grid): '''Scrolled Grid widgets''' diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py index 1c7f11a..0d048bb 100644 --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -1170,7 +1170,7 @@ class Sizegrip(Widget): Widget.__init__(self, master, "ttk::sizegrip", kw) -class Treeview(Widget): +class Treeview(Widget, tkinter.XView, tkinter.YView): """Ttk Treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list @@ -1480,16 +1480,6 @@ class Treeview(Widget): return self.tk.call(self._w, "tag", "has", tagname, item) - def xview(self, *args): - """Query or modify horizontal position of the treeview.""" - return self.tk.call(self._w, "xview", *args) - - - def yview(self, *args): - """Query or modify vertical position of the treeview.""" - return self.tk.call(self._w, "yview", *args) - - # Extensions class LabeledScale(Frame): |