On 4/19/05, Shandy Brown <sjbrown@xxxxxxxxx> wrote:
can anyone recommend any strategies for using urllib for doing simple
pulling of information with pygame?
the urlopen and urlretrieve functions block, which is not ideal for
pygame apps. how have people dealt with this, by starting a Thread?
If a Thread was used, how has the info been put back into the pygame
mainloop? Can you put an event on the pygame event queue from the
new
thread?
If you are using urllib, your only choice is to put it in a separate
thread. The document doesn't really mention anything about the thread
safety of the pygame.event module, so I would assume the worst. The
easiest and safest way to pass the data between the threads is
probably by using the Queue module from Python
(http://www.python.org/doc/2.4.1/lib/module-Queue.html).
--
Sami Hangaslammi