Ray Pasco wrote:
The wx.Rect Set_() methods seems unintuitive to me. What are the
effects on all the other attributes if, for example, Rect.SetTop() is
called ? What Set() calls cause Rect.Size to be recalculated ?
For example, I'm calling Rect.SetTopLeft() which intuitively moves the
Rect,...
...and adjusts the size...
but Rect.SetBottomRight() grows or shrinks the Size ! (The TopLeft
coordinate remains fixed.) Why does SetTopLeft() have a different
effect on the Size and Position than SetBottomRight() ? What are the
undocumented rules ?
I'm not sure what surprises you. SetTopLeft changes top and left, and
leaves bottom and right unchanged, which means the size changes.
SetBottomRight changes bottom and right, and leaves top and left
unchanged. The behavior seems perfectly rational to me, with one
possible exception:
C:\tmp>python
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> z = wx.Rect(10,20,60,70)
>>> z
wx.Rect(10, 20, 60, 70)
>>> z.SetTopLeft((1,2))
>>> z
wx.Rect(1, 2, 60, 70)
>>> z.SetBottomRight((100,200))
>>> z
wx.Rect(1, 2, 100, 199)
>>>
I don't know why that last resulted in 199 instead of 200, but the rest
of it is only natural.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.