How to work with streams in pygtk

I have a problem with threads in pygtk. My application consists of a program that downloads pictures from the Internet, and then displays it with a pigt. The problem is that for this and maintaining a flexible graphical interface I need to use threads.

So, I got a callback after the user clicked on the “Upload Images” button, and I call the method to upload images that are within the same class.

thread.start_new_thread (self.images_download, (path, pages)

This will not work. The only way my program gets into the stream is to use

gtk.threads_init ()

Before starting any topic. Now it downloads images, but the graphical interface remains unresponsive. I googled this and I tried putting gtk.threads_enter and gtk.threads_leave around threads, but it just doesn't work.

+5
source share
2 answers

Your question is a bit vague, and without reference to your real code, it is difficult to predict what you are doing wrong.

So, I will give you some pointers to read, and then speculate based on experience.

, , , , , . . . Twisted . , , , CLI, GTK+. , , , .

-, - , GTK +.

FAQ PyGTK , .

, . , GTK , . , , , , gobject.idle_add() , . .

, , , thread_enter()/threads_leave()

+12

gtk.gdk.threads_init(), gtk.gdk.threads_enter() gtk.gdk.theads_leave(), , . Linux , , win32.

=== ===

, gobject.io_add_watch, , - , . : ( ) PyGTK .

+1

All Articles