On 25/04/13 15:09, Joseph Clark wrote:
> Ok, I'm a dumb newbie, I figured out my own problem.
> I just updated the on_resize handler like so:
>  
> class GameWindow( pyglet.window.Window ):
>     def on_resize( self, width, height ):
>         print("resized",width,height)
>         pyglet.window.Window.on_resize(self,width,height)
>  
> I don't know what the default on_resize handler does or how it works,
> but this is an object-oriented world so I can just call it anyway after
> I do what I wanted to do.

Your solution works, and it's OK. But in case you want to use a more
pythonic way... you could use:

class GameWindow(pyglet.window.Window):
    def on_resize(self, width, height):
        print("resized",width,height)
        super(GameWindow, self).on_resize(width,height)

In that way you're calling the "on_resize" method of the base class of
GameWindow.

See: http://docs.python.org/2/library/functions.html#super

(pyglet uses new-style classes so it's fine)

Kind regards,

Juan

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to