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.
> 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.