[wxPython-users] OGL problem
Pierre Hjälm
pierre.hjalm at dis.uu.se
Wed Sep 20 06:21:52 PDT 2006
"nelson -" <nelson1977 at gmail.com> writes:
> Hi all!
> i'm implementing a timeline panel, like the adobe flash editor panel.
> I' trying to do it using wx.lib.ogl package. The problem i have found
> is that i can't figure out how to constraint a rectangle to don't move
> in y direction... I want be able only to move it left and right,
> evenutlly makeing it longer or shorter.... I can't find out many docs
> on ogl except a tutorial on wxpython wiki and an example in the demo.
>
> Can anyone help me?
>
I don't believe you can constrain the actual movement, but what you can
do is override OnMovePre of the rectangle and check the new coordinates.
If they're not to your liking return False and no move will be performed.
Observe that OnMovePre is also called on resizing.
def OnMovePre(self, dc, x, y, old_x, old_y, display = True):
if y != old_y:
return False
return True
or (for the wordiness averse):
def OnMovePre(self, dc, x, y, old_x, old_y, display = True):
return y == old_y
Hopefully this will work, it's been a while since I touched anything OGL.
--
Pierre Hjälm
More information about the wxpython-users
mailing list