CVS: anygui/lib/anygui/backends tkgui.py,1.83,1.84
Samuele Pedroni <[email protected]> Sat, 12 Oct 2002 16:29:20 -0700
| Newsgroups | gmane.comp.python.anygui.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/anygui/anygui/lib/anygui/backends
In directory usw-pr-cvs1:/tmp/cvs-serv10400
Modified Files:
tkgui.py
Log Message:
Fix so that test_shake passes: assured that all setXxx methods of WindowWrapper
call update_idletasks, such that the direct widget queries in the get methods
retrieve consistent up-to-date values. Added discussion to generic ComponentWrapper
about why it does not need getXxx methods and setXxx can do without update_idletasks.
Index: tkgui.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/backends/tkgui.py,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -r1.83 -r1.84
*** tkgui.py 10 Sep 2002 20:17:21 -0000 1.83
--- tkgui.py 12 Oct 2002 23:29:17 -0000 1.84
***************
*** 99,102 ****
--- 99,103 ----
if not self.visible: return
self.widget.place(width=width)
+ self.widget.update_idletasks()
def setHeight(self, height):
***************
*** 120,123 ****
--- 121,143 ----
self.widget.place(x=x, y=y, width=width, height=height)
+ # If added test_shake fails
+ # because the various self.widget.place take effect only
+ # once again in the event loop or upon update(_idletasks).
+ #
+ # Should we add a call to update_idletasks to all setXxx methods ???
+ # probably not. Getting and setting will give a consistent picture
+ # because proxies will cache the value passed to place
+ # and not defining getXxx will cause the use of those cached values.
+ # Window wrappers need getXxx methods querying the widget because of externally triggered
+ # resizing, so the set methods need update_idletasks to get consistency.
+ # See WindowWrapper.
+ #
+ # def getGeometry(self):
+ # x = self.widget.winfo_x()
+ # y = self.widget.winfo_y()
+ # w = self.widget.winfo_width()
+ # h = self.widget.winfo_height()
+ # return x,y,w,h
+
def setVisible(self, visible):
if not self.widget: return
***************
*** 645,656 ****
if not self.widget: return
ox, oy, w, h = self.getGeometry()
! geometry = "%dx%d+%d+%d" % (w, h, x, y)
! self.widget.geometry(geometry)
def setSize(self, width, height):
if not self.widget: return
x, y, ow, oh = self.getGeometry()
! geometry = "%dx%d+%d+%d" % (width, height, x, y)
! self.widget.geometry(geometry)
def setGeometry(self, x, y, width, height):
--- 665,674 ----
if not self.widget: return
ox, oy, w, h = self.getGeometry()
! self.setGeometry(x, y, w, h)
def setSize(self, width, height):
if not self.widget: return
x, y, ow, oh = self.getGeometry()
! self.setGeometry(x, y, width, height)
def setGeometry(self, x, y, width, height):
***************
*** 658,662 ****
geometry = "%dx%d+%d+%d" % (width, height, x, y)
self.widget.geometry(geometry)
! self.widget.update()
def setTitle(self, title):
--- 676,680 ----
geometry = "%dx%d+%d+%d" % (width, height, x, y)
self.widget.geometry(geometry)
! self.widget.update_idletasks()
def setTitle(self, title):
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf