Index: Lib/lib-tk/Tix.py =================================================================== --- Lib/lib-tk/Tix.py (revision 73697) +++ Lib/lib-tk/Tix.py (working copy) @@ -1801,16 +1801,21 @@ 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 +1823,7 @@ 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 +1831,46 @@ 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)" 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 +1880,6 @@ # 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,9 +1887,59 @@ args= ('-itemtype', itemtype) + args self.tk.call(self, 'set', x, y, *args) - # def size dim index ?option value ...? - # def unset x y + 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) + def xview(self): return self._getdoubles(self.tk.call(self, 'xview')) def xview_moveto(self, fraction): @@ -1876,7 +1951,7 @@ def yview(self): return self._getdoubles(self.tk.call(self, 'yview')) def yview_moveto(self, fraction): - self.tk.call(self,'ysview', 'moveto', fraction) + self.tk.call(self, 'yview', 'moveto', fraction) def yview_scroll(self, count, what="units"): "Scroll down (count>0) or up of units|pages" self.tk.call(self, 'yview', 'scroll', count, what)