[issue1135] xview/yview of Tix.Grid is broken
Guilherme Polo ggp...@gmail.com added the comment: This has been commited on r74448 now, will merge into py3k. -- resolution: - accepted status: open - closed versions: +Python 2.7, Python 3.2 -Python 2.5, Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1135 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Guilherme Polo ggp...@gmail.com added the comment: This has been commited on r74448 now, will merge into py3k. py3k: r74450 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1135 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Guilherme Polo ggp...@gmail.com added the comment: I've looked into this again and now I'm attaching a patch very similar to xview_yview.patch. Is anyone against adding these mixins ? -- Added file: http://bugs.python.org/file14673/xview_yview_mixins.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1135 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Guilherme Polo ggp...@gmail.com added the comment: I would actually prefer to move xview and yview method to classes like it was done in xview_yview.patch (I've done this on a personal branch some time ago too, but named them as XScroll, YScroll), we can see they are used in several places in Tkinter, Tix and other extensions, and we are just duplicating code for them all the time. Also, what I would prefer to see in place of this: if not args: return self._getdoubles(self.tk.call(self._w, 'xview')) self.tk.call((self._w, 'xview') + args) would be this: res = self.tk.call(self._w, 'xview', *args) if args: return self._getdoubles(res) -- nosy: +gpolo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1135 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Hirokazu Yamamoto added the comment: Sorry for late repry. I couldn't apply Issue1522587's patch itself because it was too old, so I tried only [xy]view{,_moveto,_scroll} functions by applying patch partially. (partial.patch) And yes, it worked. Added file: http://bugs.python.org/file8634/partial.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __Index: Lib/lib-tk/Tix.py === --- Lib/lib-tk/Tix.py (revision 58625) +++ Lib/lib-tk/Tix.py (working copy) @@ -1865,21 +1865,25 @@ # def size dim index ?option value ...? # def unset x y -def xview(self): -return self._getdoubles(self.tk.call(self, 'xview')) +def xview(self, *what): +if not what: +return self._getdoubles(self.tk.call(self._w, 'xview')) +self.tk.call((self._w, 'xview') + what) def xview_moveto(self, fraction): -self.tk.call(self,'xview', 'moveto', fraction) +self.tk.call(self._w,'xview', 'moveto', fraction) def xview_scroll(self, count, what=units): -Scroll right (count0) or left count of units|pages -self.tk.call(self, 'xview', 'scroll', count, what) +Scroll right (count0) or left (count0) of units|pages +self.tk.call(self._w, 'xview', 'scroll', count, what) -def yview(self): -return self._getdoubles(self.tk.call(self, 'yview')) +def yview(self, *what): +if not what: +return self._getdoubles(self.tk.call(self._w, 'yview')) +self.tk.call((self._w, 'yview') + what) def yview_moveto(self, fraction): -self.tk.call(self,'ysview', 'moveto', fraction) +self.tk.call(self._w,'yview', 'moveto', fraction) def yview_scroll(self, count, what=units): -Scroll down (count0) or up count of units|pages -self.tk.call(self, 'yview', 'scroll', count, what) +Scroll down (count0) or up (count0) of units|pages +self.tk.call(self._w, 'yview', 'scroll', count, what) class ScrolledGrid(Grid): '''Scrolled Grid widgets''' ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Changes by Martin v. Löwis: -- keywords: +patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Matthias Kievernagel added the comment: Hint: There is also Issue1522587, which contains a large patch (by klappnase) for Tix.Grid addressing xview/yview and several other issues. I do not know if it fixes this issue exactly. Can you take a look at it, ocean-city? Regards, Matthias Kievernagel -- nosy: +mkiever __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Georg Brandl added the comment: IMO the patch is not complete, the xview method should rather be implemented like these in Tkinter.py. Assigning to Martin. -- assignee: - loewis nosy: +georg.brandl, loewis __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Hirokazu Yamamoto added the comment: OK, how about this patch? I extracted [xy]view{,_moveto,_scroll} as mixin class [XY]View, and included them. It seems working. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __Index: Lib/lib-tk/Tix.py === --- Lib/lib-tk/Tix.py (revision 58194) +++ Lib/lib-tk/Tix.py (working copy) @@ -850,7 +850,7 @@ # 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 @@ -1037,12 +1037,6 @@ 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. @@ -1419,7 +1413,7 @@ if self.subwidget_list.has_key(name): 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 +1496,6 @@ 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 @@ -1777,7 +1765,7 @@ 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 @@ -1865,22 +1853,6 @@ # 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 (count0) 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 (count0) or up count of units|pages -self.tk.call(self, 'yview', 'scroll', count, what) - class ScrolledGrid(Grid): '''Scrolled Grid widgets''' Index: Lib/lib-tk/Tkinter.py === --- Lib/lib-tk/Tkinter.py (revision 58194) +++ Lib/lib-tk/Tkinter.py (working copy) @@ -1948,6 +1948,36 @@ Pack, Place or Grid. pass +class XView: +Internal class. Add methods xview, xview_moveto, xview_scroll. +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) + +class YView: +Internal class. Add methods yview, yview_moveto, yview_scroll. +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 Toplevel(BaseWidget, Wm): Toplevel widget,
[issue1135] xview/yview of Tix.Grid is broken
Sean Reifschneider added the comment: I can verify that on Red Hat 7 Python 2.5 that the test does fail and the patch resolves it. -- nosy: +jafo priority: - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Changes by Sean Reifschneider: -- nosy: -jafo __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Changes by Hirokazu Yamamoto : -- versions: +Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
New submission from Hirokazu Yamamoto : Attached code test_tixGrid.py fails with following error message. TypeError: yview() takes exactly 1 argument (4 given) -- components: Tkinter files: test_tixGrid.py messages: 55762 nosy: ocean-city severity: normal status: open title: xview/yview of Tix.Grid is broken type: behavior versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __import Tkinter as Tk def scrollable(Widget, master, *a, **kw): frame = Tk.Frame(master) frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) widget = Widget(frame, *a, **kw) widget.grid(row=0, column=0, sticky=news) scroll_x = Tk.Scrollbar(frame, command=widget.xview, orient=Tk.HORIZONTAL) scroll_x.grid(row=1, column=0, sticky=news) scroll_y = Tk.Scrollbar(frame, command=widget.yview, orient=Tk.VERTICAL) scroll_y.grid(row=0, column=1, sticky=news) widget.configure(xscrollcommand=scroll_x.set, yscrollcommand=scroll_y.set) for name in (pack, grid, place): setattr(widget, name, getattr(frame, name)) return widget import Tix root = Tix.Tk() grid = scrollable(Tix.Grid, root) grid.pack(fill=Tix.BOTH, expand=True) for y in xrange(30): for x in xrange(6): grid.set(x, y, text=repr((x, y))) root.mainloop() ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Hirokazu Yamamoto added the comment: Probably right fix is attached file fix_tixGrid.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __Index: Lib/lib-tk/Tix.py === --- Lib/lib-tk/Tix.py (revision 58052) +++ Lib/lib-tk/Tix.py (working copy) @@ -1865,16 +1865,16 @@ # def size dim index ?option value ...? # def unset x y -def xview(self): -return self._getdoubles(self.tk.call(self, 'xview')) +def xview(self, *args): +return self._getdoubles(self.tk.call(self, 'xview', *args)) def xview_moveto(self, fraction): self.tk.call(self,'xview', 'moveto', fraction) def xview_scroll(self, count, what=units): Scroll right (count0) 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(self, *args): +return self._getdoubles(self.tk.call(self, 'yview', *args)) def yview_moveto(self, fraction): self.tk.call(self,'ysview', 'moveto', fraction) def yview_scroll(self, count, what=units): ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com