On 5/29/08, Javier Garcia <[EMAIL PROTECTED]> wrote:
>
>  Hi everyone,
>
>  Is this possible?:
>
>  ###############
>
>  pyglet setup
>  socket server setup
>
>  main draw loop:
>
>     check if socket have data :      ( an external process sends this
>  data i.e.  " sprite.x=2 " )
>             process data                  (  eval(data)  )
>     else:
>             pass
>
>     normal drawing commands
>
>  pyglet.app.run()
>
>  ################
>
>  I´ve (bad) tried  threads and sockets, they always blocks my code.
>

Yes, use nonblocking sockets and reimplement/override the
pyglet.app.EventLoop.idle() function.  Alternatively, don't use
pyglet.app.run and write your own event loop:

while not exiting:
    main_window.dispatch_events()
    poll_socket()
    main_window.on_draw()
    main_window.flip()

>  Offtopic:
>
>  May I suggest a pair of tutorials
>
>  1. Using pyglet with stackless , like the Actor tutorial which uses
>  pygame, simplified if its possible

I've not played with stackless before, but I understand it's an
experimental patch only, so a tutorial for using it with pyglet is not
really appropriate (of course, please supply and publish your own!).

>  2. Defining custom events for Sprites, like a on_mouse_over event ,
>  based on bounding rectangle and based in the sprite image alpha
>  channel

Is this a veiled request for assistance in doing this, or are you
aware of the various techniques and merely suggesting that they be
published in a tutorial?  (Note that pyglet so far doesn't have any
tutorials, save the few very short examples at the beginning of the
programming guide).

Alex.

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