Doesn't help. Here is the script with added event logger for the window. On
my machine the output is:
>py testdraw.py
on_activate()
on_show()
on_resize(width=640, height=480)
on_expose()
Before Label draw.
on_deactivate()
After.
Done.
import pyglet
wincfg = pyglet.gl.Config(double_buffer=False)
window = pyglet.window.Window(config=wincfg)
window.push_handlers(pyglet.window.event.WindowEventLogger())
window.dispatch_events()
raw_input("Before Label draw.")
label = pyglet.text.Label('[]',
font_name='Lucida Console',
font_size=14,
x=10, y=10)
label.draw()
pyglet.gl.glFlush()
window.dispatch_events()
raw_input("After.")
label.draw()
pyglet.gl.glFlush()
window.dispatch_events()
raw_input("Done.")
On Tue, Dec 25, 2012 at 12:06 AM, Anonymouse <[email protected]>wrote:
> I can't be sure, but I think it's because you need to dispatch_events()
> once before drawing anything so that an on_resize event gets handled, which
> will set the projection matrix for the window. If you draw before it, the
> projection matrix is probably such that you can't see wherever the text
> gets drawn. So call window.dispatch_events() once before drawing and it
> does display.
>
>
> On 24 December 2012 16:30, anatoly techtonik <[email protected]> wrote:
>
>> Why pyglet doesn't display label on the first iteration?
>> On my Vista machine it is visible only after I hit Enter the second time.
>>
>> import pyglet
>>
>> wincfg = pyglet.gl.Config(double_buffer=False)
>> window = pyglet.window.Window(config=wincfg)
>>
>> label = pyglet.text.Label('[]',
>> font_name='Lucida Console',
>> font_size=14,
>> x=10, y=10)
>> label.draw()
>> pyglet.gl.glFlush()
>> window.dispatch_events()
>>
>> raw_input("Done.")
>>
>> label.draw()
>> pyglet.gl.glFlush()
>> window.dispatch_events()
>>
>> raw_input("Done.")
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyglet-users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/pyglet-users/-/Tr5ouPliAKMJ.
>> 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.
>>
>
> --
> 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.
>
--
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.