Re: [pygtk] Threads in GTK, yet another doubt about this mistery

2007-04-25 Thread Antoon Pardon
Sorry for my rather late answer.

On Tue, Mar 27, 2007 at 08:02:31PM -0300, Gabriel Falcão wrote:
 Hello friends!
 
 Everytime a check any program that use gtk threading i see the use of
 gobject threads init, locks, though threading.Thread before the gtk.main()
 
 But my doubt is: Why i never see the inverse?
 
 Why not put the gtk.main() inside a threading.Thread e do anything before
 this?
 I just want to know what are the problems when using it.

I don't think there are problems with it. I have one program where
gtk.main is started in a thread and it works without a problem.

It is a rather peculiar program though since it is a kind of
test suite for other GTK programs. It was the only time I
thought it usefull to have GTK started from a thread though.

-- 
Antoon Pardon
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Threads in GTK, yet another doubt about this mistery

2007-03-27 Thread Gabriel Falcão

Hello friends!

Everytime a check any program that use gtk threading i see the use of
gobject threads init, locks, though threading.Thread before the gtk.main()

But my doubt is: Why i never see the inverse?

Why not put the gtk.main() inside a threading.Thread e do anything before
this?
I just want to know what are the problems when using it.


I the  code below i demonstrate better what i want to say:

import gtk,sys
import threading
class GUI(threading.Thread):
def __init__(self):
threading.Thread.__init_ _(self)
self.gui=gtk
def run(self):
self.gui.main()

def quit(widget)
sys.exit(0)

win=gtk.Window()
win.set_default_size(200,200)
win.connect('destroy',sair)
text=gtk.Label(HELLO WORLD)
text.show()
win.add(texto)
win.show ()
#Starting the mainloop inside a thread
GUI().start()

text.set_markup(span size=\13000\HELLO THREADS!/span)


Então, por que não usar assim?
--
:wq

Atenciosamente
__
   Gabriel Falcão

Não há um caminho para o Linux, Linux é o caminho! 

Jabber: [EMAIL PROTECTED]
Blog: http://www.nacaolivre.org
GPG public key: http://www.nacaolivre.org/gabrielteratos.gpg

-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCA d-- s++: a--- C UL++ P+ L E- W++ N* o-- K- w---
O-- M+ V- PS+ PE++ Y+++ PGP++ t+ 5 X R+ tv-- b- DI-- D+++
G++ e+ h! r+++ y++
--END GEEK CODE BLOCK--

--
:wq

Atenciosamente
__
   Gabriel Falcão

Não há um caminho para o Linux, Linux é o caminho! 

Jabber: [EMAIL PROTECTED]
Blog: http://www.nacaolivre.org
GPG public key: http://www.nacaolivre.org/gabrielteratos.gpg

-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCA d-- s++: a--- C UL++ P+ L E- W++ N* o-- K- w---
O-- M+ V- PS+ PE++ Y+++ PGP++ t+ 5 X R+ tv-- b- DI-- D+++
G++ e+ h! r+++ y++
--END GEEK CODE BLOCK--
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Threads with Gtk?

1999-11-16 Thread Hrvoje Niksic

What is the current level of support for threading in PyGTK?  Last
time I checked, threading had problems because threads weren't enabled
upon entrance to main loop, and in several other places.

Specifically, how does Gtk's threading model mesh with Python's
threading?  Is it possible for the main loop to be running in a
separate thread (and the application be responsive) while different
Python threads do useful work and update widgets accordingly?
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Threads with Gtk?

1999-11-16 Thread James Henstridge

You should be able to use python threading without problems.  Just
remember that you have to acquire the GTK thread lock with
threads_enter(), and release it with threads_leave() afterwards, when you
do any GTK calls.

Note that you don't need to acquire the gtk thread lock from within signal
handlers, but do have to from within timeout, idle and IO callback
functions.

Also, get a recent version (= 0.6.2) as things did not work correctly
with previous versions.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On 16 Nov 1999, Hrvoje Niksic wrote:

 What is the current level of support for threading in PyGTK?  Last
 time I checked, threading had problems because threads weren't enabled
 upon entrance to main loop, and in several other places.
 
 Specifically, how does Gtk's threading model mesh with Python's
 threading?  Is it possible for the main loop to be running in a
 separate thread (and the application be responsive) while different
 Python threads do useful work and update widgets accordingly?
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]