On May 28, 9:01 pm, 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()

In addition to what Alex said, you can probably use select() to only
read from sockets that are ready. Or, you can do the blocking socket
reading in a background thread and pass the data in via a queue
(http://docs.python.org/lib/module-Queue.html), checking that each
update to see if there's any data on it.

However, you don't really want to do this bit: eval(data)
The first time someone connects to your program and sends the Python
code for deleting all the files on your hard disk, you'll realise what
a bad idea it is.

--
Ben Sizer

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