[pygtk] Socket listening

Maxime Ripard maxime.ripard at anandra.org
Tue May 5 19:39:51 WST 2009


Hi,

I am new to pyGTK, and I have few problems writing a GUI for an existing
program.

One of the purpose of the program is to set up BOOTP and TFTP servers,
to allow a PXE boot. Both servers are in different threads than the
program itself.

If was formerly using a cli, and everything was going fine.

I now want to use a GUI, so I decided to use pyGTK and Glade.

All the behaviour of my program is wrapped in a class, instanciated by
both interfaces, in the same way. But with the GUI, everything is fine,
the servers are launched and listen properly, except that nothing seems
to come to them.

I have read somewhere that when you need to listen on sockets while
running the event loop, you have to use gtk.input_add(), but what if the
sockets aren't in the same thread ? Do I have to use it anyway ?

Launching the cli using subprocess.Popen within the GUI handlers makes
it work, but it is kind of dirty to me, and not really what I want ...

Is there any solution ?

-- 
Maxime Ripard
Étudiant à l'Université de Technologie de Belfort - Montbéliard (UTBM)
Génie Informatique (GI 03)

86 bis rue du temple de Blosne
35136 Saint Jacques de la Lande
France

06 85 40 57 32
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090505/b52ae3ad/attachment.pgp 


More information about the pygtk mailing list