Pyglet window will not redraw on resize
I have a class that is subclassed to pyglet.window.Window, and I need it
to be a resizable window. I figured out how to enable it to be resized,
but I need to make it redraw everything on the screen when I actually do
resize it. Here's what I have so far:
if __name__ == '__main__':
window = Application()
@window.event()
def on_resize(x,y):
window.label.x = window.WindowSize[0]/2
window.label.y = window.WindowSize[1]*15/16
@window.event()
def on_draw():
window.clear()
window.label.draw()
for control in window.controls:
control.draw()
pyglet.app.run()
so we make our window and then have those two window events. I hope I did
that right--I'm fairly new to pyglet. As I said, the main problem is that
when I resize the window it doesn't actually change anything unless I
press one of the buttons on the window which changes the positions.
No comments:
Post a Comment