Re: Fundamentals of GTK



On Tue, 2006-04-04 at 19:20 -0700, 3saul wrote:
OK I'm having some trouble understanding how a GTK application actually
works. I've created a few terminal based applications in C for linux. When I
want my application to continually perform a particular function I set up a
loop. Within this loop I call the functions to update data etc....

So now I'm wanting to do something very simple like update the GUI in gtk
with newly aquired data (text on a menu button label). But I have no idea
how this works. The tutorials I've seen show you how to update data when an
event occurs such as clicking on a button...but not how to update
information continually...with no user interaction. Are there any tutorials
on how to do this? I have looked through the API refs etc but I just can't
grasp how to do this...so any help would be very much appreciated.

There are several ways to update a gui from a non-gui even source
1. g_idle_add() - when the gui is idle, poll some source for data
2. use io channels to generate callbacks when data arrives in pipes,
files, or sockets -- see
http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html
3. threads, update the GUI through some kind of  IPC mechanism (threads
and guis are kind of tricky)

The following post has an example that spawns a process and puts the
process' output into the GTK gui:
http://mail.gnome.org/archives/gtk-app-devel-list/2004-
March/msg00026.html

Michael





Thanks
--
View this message in context: http://www.nabble.com/Fundamentals-of-GTK-t1396951.html#a3756984
Sent from the Gtk+ - Apps Dev forum at Nabble.com.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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