[Glade-users] Getting data during a loop



On Sat, Feb 23, 2008 at 11:31 PM, dj <westli1 at yahoo.com> wrote:

I am working on a program for controlling my shortwave
receiver using Glade, pyGTK, and python.


Hi, this is a gtk+ related question and would be better targetted
at gtk-app-devel-list at gnome.org, however, the problem you are
experiencing is simply put, during the routine in which you are
reading and printing to the console and updating a treeview, you
are never returning to the main loop, and so since you never return
to the main loop the GUI updates are never processed.

Generally you would have some kind of data handler (a GIOChannel
possibly) and handle a bit of data at a time and always remember to
return ;-)

other ways of dealing with this include using GThread (I dont think
you need to deal with that), or the famous old:

  while (events_pending())
      itteration_do ();

which might be better for you, if you are writing new code though I
would suggest you handle the data in itterations and get used to
proper single thread event based programming (especially if event
flow is important in your app, you might try staying away from too
much hacked out recursive envokation of the main loop).

Cheers,
                 -Tristan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20080224/1e6b7ee1/attachment.html 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]