On Sun, Dec 28, 2008 at 9:25 AM, Simon Wittber <[email protected]>wrote:

>
> On Dec 28, 8:08 pm, "Alex Holkner" <[email protected]> wrote:
>
> > I believe this is because you're attaching the event handler after the
> > window has already been displayed (and initially sized).  Adding
> > visible=False to the constructor and calling window.set_visible()
> > before run() should fix the issue.
>
> Thanks for the ideas. Using the above didn't work immediately, but I
> did try:
>
> window.on_resize = on_resize
>
> just before I started the app loop, which fixed the problem.


Right, that would do the trick. When you use the @event decorator, the new
on_resize handler is added, rather than the existing one being replaced -
thus the original handler will be called *after* your new handler, which
will reset the projection to the default.

However, you can return pyglet.event.EVENT_HANDLED from your new handler,
which tells pyglet not to run any further handlers, including the default
handler.

@alex: I didn't really find mention of this in the docs, perhaps it should
go into the FAQ?

-Sw.
> >
>


-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

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

Reply via email to