I don't think it's a bug, as usually in wxWidgets/wxPython "-1" is
interpreted as "use whatever default exists for this particular
widget/sizer/OS/machine". So, by using SetPosition((-1, 10)) wxPython
assumes you want to default the x coordinate. I may be wrong, so I
would appreciate if someone else will correct my ignorance in this
matter.
Thanks for the response. You explanation makes a lot of sense.
However, since -1 is a valid coordinate position, I don't understand
how that can be correct behavior. Since -1 is a valid coordinate
position,
it should not cause a default value(which appears to be the current value
of that coordinate) to be used instead.
Since -1 is a special sentinel, perhaps calling
wx.SetPosition(wx.Point(-1,-1)) will work instead of (-1,-1)? Just a total
shot in the dark guess.
Actually I had tried that, but on my platform nothing changed... it
seems like -1 is the magic number whatever you try to do
You guys are all real close and on the right track. -1 is used for "default" in most places, but in this case it means, "don't change the current values." Most of the position and size methods in wx.Window are just convenience wrappers around the SetSize method that takes 5 parameters (which is called SetDimensions in wxPython.) For example, if what you usually use as SetSize were to be written in Python it would look like this:
def SetPosition(self, x, y):
self.SetDimensions(x, y, -1,-1, wx.SIZE_USE_EXISTING)
So as Nitro said, if you want to allow -1 to be a valid position then you'll need to call SetDimentions with the wx.SIZE_ALLOW_MINUS_ONE, and also include the current width and height parameters.
···
On Nov 21, 2007 12:03 AM, Stephen Hansen wrote:
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!