Please help me unsubscribe from this list
Please help me un-subscribe from this list thanks ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
displaying a live plot using Gtkdatabox widget
Hi, I want to display a plot of data set comprising of (X & Y) cordinates and also update it, say after 1 second using Gtkdatabox widget. Could someone suggest a simple code snippet that does that for GTK+-2.0.0. Adeel ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem with installing GTK+-2.0.0 on Fedora Core 6
The structure of my code is that when I click on the 'start button', the callback function needs to continuously acquire data from a daq card in a while loop, a functionality that I am not supposed to change. Now I want to send a refesh signal to control (during the course of button callback function) and one way to do this it to call a g_timer_add function which my current gtk_installation (gtk 1.2.10) doesn't support. --- On Mon, 5/11/09, Vlad Volodin wrote: From: Vlad Volodin Subject: Re: Problem with installing GTK+-2.0.0 on Fedora Core 6 To: adeelmali...@yahoo.com Cc: "gtk-app" Date: Monday, May 11, 2009, 12:55 PM It looks like you've already asked the question before: http://mail.gnome.org/archives/gtk-app-devel-list/2009-March/msg00115.html as I understood, you have "Main Loop" (read about it in Gtk and GLib), a thread which get data from your "stuff" and calculates the average value. So, don't try to make main loop runs faster than it is. maybe you should send a refresh (or repaint, update) signal to your control. what do you think ab. it? 2009/5/11 Adeel Malik : > Hi, > The main gtk thread needs to refresh an image widget (for status > indication, GREEN or RED) along with a couple of 'status variables' > e.g Block/Symbol error rate using labels. There is a start button in the GUI > associated with a data acquisition routine that computes the value of the > aforesaid variables and in a busy while loop. All I want is to compute the > average varibale value, say for last 1000 iterations, and display on the GUI > after every 100 ms or so. > cheers, > Adeel > > --- On Mon, 5/11/09, Vlad Volodin wrote: > > From: Vlad Volodin > Subject: Re: Problem with installing GTK+-2.0.0 on Fedora Core 6 > To: adeelmali...@yahoo.com > Cc: "gtk-app" > Date: Monday, May 11, 2009, 11:43 AM > > Hello, > > What is the purpose of your update? Do you want to refresh a widget, > or anything else? > > Vlad Volodin > > > > 2009/5/11 Adeel Malik : >> Hi, I was wondering how to update the gtk_main_thread function after a > fixed time interval (in milliseconds) as g_timer_add function provides a > quick > solution to that. Could someone suggest how to go about it ?. >> >> Thanks, >> Adeel >> >> --- On Sat, 5/9/09, Ardhan Madras wrote: >> >> From: Ardhan Madras >> Subject: Re: Problem with installing GTK+-2.0.0 on Fedora Core 6 >> To: adeelmali...@yahoo.com >> Cc: gtk-app-devel-list@gnome.org >> Date: Saturday, May 9, 2009, 7:49 PM >> >> One of GTK+ dependency is GLib, each GTK+ version has it's GLib > version >> dependency too, if you try to compile a newer GTK+ version in a system > that has >> not meet it's minimal requirement of GLib version then they will > complain. >> >> You tried to update GLib on your distro using a package manager, you will > got >> nothing to do because your distro will not broke all dependency that it > already >> made. Moving from 2.4.0 to 2.12.3 is not trivial, this will break many >> applications that already installed, so they must have to update all >> applications to meet the new dependency. Distributor tend to release a new >> distro version rather than rebuild and update applications in the their > current >> version. >> >> g_timer_add()? i don't know if this was a obsolete function, but i > think >> there are a lot way to write codes such this function does. I can't > see a >> reason why you should move to a version of GTK+ because of this function! >> >> --- ajhwb >> >> >> --- adeelmali...@yahoo.com wrote: >> >> From: Adeel Malik >> To: gtk-app-devel-list@gnome.org >> Subject: Problem with installing GTK+-2.0.0 on Fedora Core 6 >> Date: Fri, 8 May 2009 21:13:24 -0700 (PDT) >> >> >> Hi All, >> I am doing application development on Fedora Core 6 Linux >> machine which had GTK version 1.2.1 already installed. I needed to use >> g_timer_add gnome function in my gtk application which doesn't seem > to be >> supported on this version. So i tried to install the newer version of > GTK+-2.0.0 >> from the gtk.org web page. >> Once I copied tar.gz file and tried to install the app. by running the >> './configure' script, the insatallation process stopped at the > following >> error messages: >> > - >> checking for GLIB - version >= 2.0.0...
Re: Problem with installing GTK+-2.0.0 on Fedora Core 6
Hi, The main gtk thread needs to refresh an image widget (for status indication, GREEN or RED) along with a couple of 'status variables' e.g Block/Symbol error rate using labels. There is a start button in the GUI associated with a data acquisition routine that computes the value of the aforesaid variables and in a busy while loop. All I want is to compute the average varibale value, say for last 1000 iterations, and display on the GUI after every 100 ms or so. cheers, Adeel --- On Mon, 5/11/09, Vlad Volodin wrote: From: Vlad Volodin Subject: Re: Problem with installing GTK+-2.0.0 on Fedora Core 6 To: adeelmali...@yahoo.com Cc: "gtk-app" Date: Monday, May 11, 2009, 11:43 AM Hello, What is the purpose of your update? Do you want to refresh a widget, or anything else? Vlad Volodin 2009/5/11 Adeel Malik : > Hi, I was wondering how to update the gtk_main_thread function after a fixed time interval (in milliseconds) as g_timer_add function provides a quick solution to that. Could someone suggest how to go about it ?. > > Thanks, > Adeel > > --- On Sat, 5/9/09, Ardhan Madras wrote: > > From: Ardhan Madras > Subject: Re: Problem with installing GTK+-2.0.0 on Fedora Core 6 > To: adeelmali...@yahoo.com > Cc: gtk-app-devel-list@gnome.org > Date: Saturday, May 9, 2009, 7:49 PM > > One of GTK+ dependency is GLib, each GTK+ version has it's GLib version > dependency too, if you try to compile a newer GTK+ version in a system that has > not meet it's minimal requirement of GLib version then they will complain. > > You tried to update GLib on your distro using a package manager, you will got > nothing to do because your distro will not broke all dependency that it already > made. Moving from 2.4.0 to 2.12.3 is not trivial, this will break many > applications that already installed, so they must have to update all > applications to meet the new dependency. Distributor tend to release a new > distro version rather than rebuild and update applications in the their current > version. > > g_timer_add()? i don't know if this was a obsolete function, but i think > there are a lot way to write codes such this function does. I can't see a > reason why you should move to a version of GTK+ because of this function! > > --- ajhwb > > > --- adeelmali...@yahoo.com wrote: > > From: Adeel Malik > To: gtk-app-devel-list@gnome.org > Subject: Problem with installing GTK+-2.0.0 on Fedora Core 6 > Date: Fri, 8 May 2009 21:13:24 -0700 (PDT) > > > Hi All, > I am doing application development on Fedora Core 6 Linux > machine which had GTK version 1.2.1 already installed. I needed to use > g_timer_add gnome function in my gtk application which doesn't seem to be > supported on this version. So i tried to install the newer version of GTK+-2.0.0 > from the gtk.org web page. > Once I copied tar.gz file and tried to install the app. by running the > './configure' script, the insatallation process stopped at the following > error messages: > - > checking for GLIB - version >= 2.0.0... > *** 'pkg-config --modversion glib-2.0' returned 2.12.3, but GLIB > (2.4.0) > *** was found! If pkg-config was correct, then it is best > *** to remove the old version of GLib. You may also be able to fix the error > *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing > *** /etc/ld.so.conf. Make sure you have run ldconfig if that is > *** required on your system. > *** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH > *** to point to the correct configuration files > no > configure: error: > - > > I treid to update the glib library by running: > > 'yum update glib' or 'yum install glib' but it appeared that > kernel couldn't find the match and issued the following messages: > - > Loading "installonlyn" plugin > Setting up Update Process > Setting up repositories > core 100% |=| 1.1 kB 00:00 > updates 100% |=| 951 B 00:00 > extras 100% |=| 951 B 00:00 > Reading repository metadata in from local files > Could not find update match for glib > No Packages marked for Update/Obsoletion > --
Re: Problem with installing GTK+-2.0.0 on Fedora Core 6
Hi, I was wondering how to update the gtk_main_thread function after a fixed time interval (in milliseconds) as g_timer_add function provides a quick solution to that. Could someone suggest how to go about it ?. Thanks, Adeel --- On Sat, 5/9/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with installing GTK+-2.0.0 on Fedora Core 6 To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Saturday, May 9, 2009, 7:49 PM One of GTK+ dependency is GLib, each GTK+ version has it's GLib version dependency too, if you try to compile a newer GTK+ version in a system that has not meet it's minimal requirement of GLib version then they will complain. You tried to update GLib on your distro using a package manager, you will got nothing to do because your distro will not broke all dependency that it already made. Moving from 2.4.0 to 2.12.3 is not trivial, this will break many applications that already installed, so they must have to update all applications to meet the new dependency. Distributor tend to release a new distro version rather than rebuild and update applications in the their current version. g_timer_add()? i don't know if this was a obsolete function, but i think there are a lot way to write codes such this function does. I can't see a reason why you should move to a version of GTK+ because of this function! --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: gtk-app-devel-list@gnome.org Subject: Problem with installing GTK+-2.0.0 on Fedora Core 6 Date: Fri, 8 May 2009 21:13:24 -0700 (PDT) Hi All, I am doing application development on Fedora Core 6 Linux machine which had GTK version 1.2.1 already installed. I needed to use g_timer_add gnome function in my gtk application which doesn't seem to be supported on this version. So i tried to install the newer version of GTK+-2.0.0 from the gtk.org web page. Once I copied tar.gz file and tried to install the app. by running the './configure' script, the insatallation process stopped at the following error messages: - checking for GLIB - version >= 2.0.0... *** 'pkg-config --modversion glib-2.0' returned 2.12.3, but GLIB (2.4.0) *** was found! If pkg-config was correct, then it is best *** to remove the old version of GLib. You may also be able to fix the error *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing *** /etc/ld.so.conf. Make sure you have run ldconfig if that is *** required on your system. *** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH *** to point to the correct configuration files no configure: error: - I treid to update the glib library by running: 'yum update glib' or 'yum install glib' but it appeared that kernel couldn't find the match and issued the following messages: - Loading "installonlyn" plugin Setting up Update Process Setting up repositories core 100% |=| 1.1 kB 00:00 updates 100% |=| 951 B 00:00 extras 100% |=| 951 B 00:00 Reading repository metadata in from local files Could not find update match for glib No Packages marked for Update/Obsoletion - I was wondering whether the problem is with the 'yum' package as it is unable to find the requested Glib library. Since the whole point of installing the new version of GTK was to be able to use the 'g_timer_add' function, can some one suggest if it is possible to use this function with the GTK 1.2.1 version. If not, can someone point out how can I fix the installation error if GTK+-2.0.0. Thanks, Adeel ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _ Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Problem with installing GTK+-2.0.0 on Fedora Core 6
Hi All, I am doing application development on Fedora Core 6 Linux machine which had GTK version 1.2.1 already installed. I needed to use g_timer_add gnome function in my gtk application which doesn't seem to be supported on this version. So i tried to install the newer version of GTK+-2.0.0 from the gtk.org web page. Once I copied tar.gz file and tried to install the app. by running the './configure' script, the insatallation process stopped at the following error messages: - checking for GLIB - version >= 2.0.0... *** 'pkg-config --modversion glib-2.0' returned 2.12.3, but GLIB (2.4.0) *** was found! If pkg-config was correct, then it is best *** to remove the old version of GLib. You may also be able to fix the error *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing *** /etc/ld.so.conf. Make sure you have run ldconfig if that is *** required on your system. *** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH *** to point to the correct configuration files no configure: error: - I treid to update the glib library by running: 'yum update glib' or 'yum install glib' but it appeared that kernel couldn't find the match and issued the following messages: - Loading "installonlyn" plugin Setting up Update Process Setting up repositories core 100% |=| 1.1 kB 00:00 updates 100% |=| 951 B 00:00 extras 100% |=| 951 B 00:00 Reading repository metadata in from local files Could not find update match for glib No Packages marked for Update/Obsoletion - I was wondering whether the problem is with the 'yum' package as it is unable to find the requested Glib library. Since the whole point of installing the new version of GTK was to be able to use the 'g_timer_add' function, can some one suggest if it is possible to use this function with the GTK 1.2.1 version. If not, can someone point out how can I fix the installation error if GTK+-2.0.0. Thanks, Adeel ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem with continuous image updation
Hi Ardhan, Currently I have GTK+1.2 version installed on the system which is giving 'undefined reference' errors for function g_thread_create function once I compile the code. Is there any way around or I need to upgrade to GTK+2.0 version. Adeel --- On Mon, 3/23/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with continuous image updation To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Monday, March 23, 2009, 2:13 PM If you want to use a thread and to prevent blocking, the thread code maybe something like this: thread_func () { while (loop_condition) { /* do data acquisition */ if (condition_1) g_idle_add (); if (condition_2) g_idle_add (); ... /* small delay */ } } Like g_timeout_add*(), g_idle_add*() also call a GSourceFunc function. It runs in main thread, so you can set your widget in the calling function. --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Subject: Re: Problem with continuous image updation Date: Mon, 23 Mar 2009 00:35:41 -0700 (PDT) Hi, In the button calback function I need to do data acquisition and processing in real-time before updating the status periodically (i.e every 1ms) using g_timeout_add function. So thatswhy there is a while loop in the callback function. Since current approach is not working, can I use threads in this case. Adeel --- On Fri, 3/20/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with continuous image updation To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Friday, March 20, 2009, 8:55 AM Hi, As i said before, don't try busy loop in the main loop bacause your program is not responsive (depend on your CPU), so your program will not updated!. Look at g_timeout_add*() manual, it is a integer (bool) function, if you returning TRUE (not 0) the the source is called again as given by the interval time. So you don't need a loop here, and you only need to call g_timeout*() function ONCE!. To remove the source, just provide mechanism to returning FALSE (0) value or use g_source_remove(). --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Subject: Re: Problem with continuous image updation Date: Thu, 19 Mar 2009 06:02:14 -0700 (PDT) Hi Ardhan, Thanks for the reply. I modified the code as per your suggestion by attaching the new source in the button callback function. I observed that the source function was executed after a specified time interval(e.g 200ms) but the display still couldn't update. As there is a while loop in my button callback function, could you please suggest whether I should call the g_timeout_add function in the while loop or outside of it. My current code structure looks like this: button_callback(...) { gprint("button pressed"); while(...) { tag=g_timeout_add(200,showhide,NULL) if(tag) { g_source_remove(tag) tag=g_timeout_add(200,showhide,NULL) } check status; ... other processing }//end button callback function static showhide () { if (STATUS) hide(RED) & show(GREEN) else hide(GREEN) & show(RED) } Regards, Adeel --- On Wed, 3/18/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with continuous image updation To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Wednesday, March 18, 2009, 5:05 PM Looks like you want to update a widget state by running a busy loop in a main loop or by using small delay. If you try this, your widget is never (look) updated.., avoid using sleep or busy loop in the gtk_main() main loop. you should try attach a new source with g_timeout_add*() functions, and set a timeout when the function should be called. Notice that g_timeout_add*() may be delayed. ... static gboolean show_hide (gpointer data) { static gboolean state = TRUE; if (state) { gtk_widget_show (green); gtk_widget_hide (red); state = FALSE; } else { gtk_widget_show (red); gtk_widget_hide (green); state = TRUE; } return TRUE; } ... and in the button callback, try: g_timeout_add (200, (GSourceFunc) show_hide, NULL); /* call every 200ms */ to remove the source, use g_source_remove(). Another way is to create thread, then call g_idle_add() to set your widgets. --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: Jim George Cc: gtk-app-devel-list@gnome.org Subject: Re: Problem with continuous image updation Date: Wed, 18 Mar 2009 02:31:23 -0700 (PDT) In my application, I am implementing status indication (displaying either 'red' or 'green' ) by using Gdkpixmap to assign an image to 'red' or 'green' pixel array. I display or hide the image by calling gtk_widget_show (..) or gtk_widget_hide(..) once the start button is clicked in
Re: Problem with continuous image updation
Hi, In the button calback function I need to do data acquisition and processing in real-time before updating the status periodically (i.e every 1ms) using g_timeout_add function. So thatswhy there is a while loop in the callback function. Since current approach is not working, can I use threads in this case. Adeel --- On Fri, 3/20/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with continuous image updation To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Friday, March 20, 2009, 8:55 AM Hi, As i said before, don't try busy loop in the main loop bacause your program is not responsive (depend on your CPU), so your program will not updated!. Look at g_timeout_add*() manual, it is a integer (bool) function, if you returning TRUE (not 0) the the source is called again as given by the interval time. So you don't need a loop here, and you only need to call g_timeout*() function ONCE!. To remove the source, just provide mechanism to returning FALSE (0) value or use g_source_remove(). --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Subject: Re: Problem with continuous image updation Date: Thu, 19 Mar 2009 06:02:14 -0700 (PDT) Hi Ardhan, Thanks for the reply. I modified the code as per your suggestion by attaching the new source in the button callback function. I observed that the source function was executed after a specified time interval(e.g 200ms) but the display still couldn't update. As there is a while loop in my button callback function, could you please suggest whether I should call the g_timeout_add function in the while loop or outside of it. My current code structure looks like this: button_callback(...) { gprint("button pressed"); while(...) { tag=g_timeout_add(200,showhide,NULL) if(tag) { g_source_remove(tag) tag=g_timeout_add(200,showhide,NULL) } check status; ... other processing }//end button callback function static showhide () { if (STATUS) hide(RED) & show(GREEN) else hide(GREEN) & show(RED) } Regards, Adeel --- On Wed, 3/18/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with continuous image updation To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Wednesday, March 18, 2009, 5:05 PM Looks like you want to update a widget state by running a busy loop in a main loop or by using small delay. If you try this, your widget is never (look) updated.., avoid using sleep or busy loop in the gtk_main() main loop. you should try attach a new source with g_timeout_add*() functions, and set a timeout when the function should be called. Notice that g_timeout_add*() may be delayed. ... static gboolean show_hide (gpointer data) { static gboolean state = TRUE; if (state) { gtk_widget_show (green); gtk_widget_hide (red); state = FALSE; } else { gtk_widget_show (red); gtk_widget_hide (green); state = TRUE; } return TRUE; } ... and in the button callback, try: g_timeout_add (200, (GSourceFunc) show_hide, NULL); /* call every 200ms */ to remove the source, use g_source_remove(). Another way is to create thread, then call g_idle_add() to set your widgets. --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: Jim George Cc: gtk-app-devel-list@gnome.org Subject: Re: Problem with continuous image updation Date: Wed, 18 Mar 2009 02:31:23 -0700 (PDT) In my application, I am implementing status indication (displaying either 'red' or 'green' ) by using Gdkpixmap to assign an image to 'red' or 'green' pixel array. I display or hide the image by calling gtk_widget_show (..) or gtk_widget_hide(..) once the start button is clicked in the main gtk window. The structure of my application is as follows: int main() { 1. Assign Pixmaps 2. Set up the start button 3. Wait for the start button press 3. rest in gtk_main () } button_function(...) { //while loop while (...) { .. if status=0 { gtk_widget_hide(green); gtk_widget_show(red); } else { gtk_widget_hide(red); gtk_widget_show(green); } It appears that gtk is not upating the image during the whole course of while loop (which is running at just 15 cycles/s) based on 'status' variable. However, afer the while loop is finished, I get the updated status image. Could someone suggest what additonal gtk calls I have to make to make sure that the status image is updated (red or green) whenever there is a change in the value of status variable in the while loop of ' start button' function. Thanks, Adeel --- On Tue, 3/10/09, Jim George wrote: From: Jim George Subject: Re: Continuous variable updation in a text box To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Date: Tuesday, March 10, 2009, 8:19 PM It wouldn't matter too much, since most screens would only have a refresh rate of 60-120 H
Re: Problem with continuous image updation
Hi Ardhan, Thanks for the reply. I modified the code as per your suggestion by attaching the new source in the button callback function. I observed that the source function was executed after a specified time interval(e.g 200ms) but the display still couldn't update. As there is a while loop in my button callback function, could you please suggest whether I should call the g_timeout_add function in the while loop or outside of it. My current code structure looks like this: button_callback(...) { gprint("button pressed"); while(...) { tag=g_timeout_add(200,showhide,NULL) if(tag) { g_source_remove(tag) tag=g_timeout_add(200,showhide,NULL) } check status; ... other processing }//end button callback function static showhide () { if (STATUS) hide(RED) & show(GREEN) else hide(GREEN) & show(RED) } Regards, Adeel --- On Wed, 3/18/09, Ardhan Madras wrote: From: Ardhan Madras Subject: Re: Problem with continuous image updation To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Wednesday, March 18, 2009, 5:05 PM Looks like you want to update a widget state by running a busy loop in a main loop or by using small delay. If you try this, your widget is never (look) updated.., avoid using sleep or busy loop in the gtk_main() main loop. you should try attach a new source with g_timeout_add*() functions, and set a timeout when the function should be called. Notice that g_timeout_add*() may be delayed. ... static gboolean show_hide (gpointer data) { static gboolean state = TRUE; if (state) { gtk_widget_show (green); gtk_widget_hide (red); state = FALSE; } else { gtk_widget_show (red); gtk_widget_hide (green); state = TRUE; } return TRUE; } ... and in the button callback, try: g_timeout_add (200, (GSourceFunc) show_hide, NULL); /* call every 200ms */ to remove the source, use g_source_remove(). Another way is to create thread, then call g_idle_add() to set your widgets. --- ajhwb --- adeelmali...@yahoo.com wrote: From: Adeel Malik To: Jim George Cc: gtk-app-devel-list@gnome.org Subject: Re: Problem with continuous image updation Date: Wed, 18 Mar 2009 02:31:23 -0700 (PDT) In my application, I am implementing status indication (displaying either 'red' or 'green' ) by using Gdkpixmap to assign an image to 'red' or 'green' pixel array. I display or hide the image by calling gtk_widget_show (..) or gtk_widget_hide(..) once the start button is clicked in the main gtk window. The structure of my application is as follows: int main() { 1. Assign Pixmaps 2. Set up the start button 3. Wait for the start button press 3. rest in gtk_main () } button_function(...) { //while loop while (...) { .. if status=0 { gtk_widget_hide(green); gtk_widget_show(red); } else { gtk_widget_hide(red); gtk_widget_show(green); } It appears that gtk is not upating the image during the whole course of while loop (which is running at just 15 cycles/s) based on 'status' variable. However, afer the while loop is finished, I get the updated status image. Could someone suggest what additonal gtk calls I have to make to make sure that the status image is updated (red or green) whenever there is a change in the value of status variable in the while loop of ' start button' function. Thanks, Adeel --- On Tue, 3/10/09, Jim George wrote: From: Jim George Subject: Re: Continuous variable updation in a text box To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Date: Tuesday, March 10, 2009, 8:19 PM It wouldn't matter too much, since most screens would only have a refresh rate of 60-120 Hz, which is also much higher than what most people can even see. I've handled such cases by using g_idle_add when I get an update of the variable's status, and have the idle function update the text box. I preserve the event source ID for the next call, and check if that source is still available. If so, I remove the event using g_source_remove and add a new idle event. This way, the most recent update is shown on screen the next time my program goes idle. The idle function then marks the source as free, by setting it to zero. -Jim Ardhan Madras wrote: > So you will need call textbox insertion (update) 1000 times per second or the textbox get updated every 1ms, my question is: Can you see it changes correctly with given cycle? > > --- adeelmali...@yahoo.com wrote: > > From: Adeel Malik > To: gtk-app-devel-list@gnome.org > Subject: Continuous variable updation in a text box > Date: Tue, 10 Mar 2009 02:48:15 -0700 (PDT) > > I intend to monitor the variable's value (acquired via data acquisition hardware) at a rate of around 1,000 times per second. > I haven't used textboxes before in GTK+. Could anyone suggest how to update the value of a variable in a textbox etc., at this rate. > Thank
Re: Problem with continuous image updation
In my application, I am implementing status indication (displaying either 'red' or 'green' ) by using Gdkpixmap to assign an image to 'red' or 'green' pixel array. I display or hide the image by calling gtk_widget_show (..) or gtk_widget_hide(..) once the start button is clicked in the main gtk window. The structure of my application is as follows: int main() { 1. Assign Pixmaps 2. Set up the start button 3. Wait for the start button press 3. rest in gtk_main () } button_function(...) { //while loop while (...) { .. if status=0 { gtk_widget_hide(green); gtk_widget_show(red); } else { gtk_widget_hide(red); gtk_widget_show(green); } It appears that gtk is not upating the image during the whole course of while loop (which is running at just 15 cycles/s) based on 'status' variable. However, afer the while loop is finished, I get the updated status image. Could someone suggest what additonal gtk calls I have to make to make sure that the status image is updated (red or green) whenever there is a change in the value of status variable in the while loop of ' start button' function. Thanks, Adeel --- On Tue, 3/10/09, Jim George wrote: From: Jim George Subject: Re: Continuous variable updation in a text box To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Date: Tuesday, March 10, 2009, 8:19 PM It wouldn't matter too much, since most screens would only have a refresh rate of 60-120 Hz, which is also much higher than what most people can even see. I've handled such cases by using g_idle_add when I get an update of the variable's status, and have the idle function update the text box. I preserve the event source ID for the next call, and check if that source is still available. If so, I remove the event using g_source_remove and add a new idle event. This way, the most recent update is shown on screen the next time my program goes idle. The idle function then marks the source as free, by setting it to zero. -Jim Ardhan Madras wrote: > So you will need call textbox insertion (update) 1000 times per second or the textbox get updated every 1ms, my question is: Can you see it changes correctly with given cycle? > > --- adeelmali...@yahoo.com wrote: > > From: Adeel Malik > To: gtk-app-devel-list@gnome.org > Subject: Continuous variable updation in a text box > Date: Tue, 10 Mar 2009 02:48:15 -0700 (PDT) > > I intend to monitor the variable's value (acquired via data acquisition hardware) at a rate of around 1,000 times per second. > I haven't used textboxes before in GTK+. Could anyone suggest how to update the value of a variable in a textbox etc., at this rate. > Thanks, > Adeel > > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > > > > _ > Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem with continuous image updation in a while loop
In my application, I am implementing status indication (displaying either 'red' or 'green' ) by using Gdkpixmap to assign an image to 'red' or 'green' pixel array. i display or hide the image by calling gtk_widget_show (..) or gtk_widget_hide(..) . The structure of my application is as follows: int main() { 1. Assign Pixmaps --- On Tue, 3/10/09, Jim George wrote: From: Jim George Subject: Re: Continuous variable updation in a text box To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Date: Tuesday, March 10, 2009, 8:19 PM It wouldn't matter too much, since most screens would only have a refresh rate of 60-120 Hz, which is also much higher than what most people can even see. I've handled such cases by using g_idle_add when I get an update of the variable's status, and have the idle function update the text box. I preserve the event source ID for the next call, and check if that source is still available. If so, I remove the event using g_source_remove and add a new idle event. This way, the most recent update is shown on screen the next time my program goes idle. The idle function then marks the source as free, by setting it to zero. -Jim Ardhan Madras wrote: > So you will need call textbox insertion (update) 1000 times per second or the textbox get updated every 1ms, my question is: Can you see it changes correctly with given cycle? > > --- adeelmali...@yahoo.com wrote: > > From: Adeel Malik > To: > Subject: Continuous variable updation in a text box > Date: Tue, 10 Mar 2009 02:48:15 -0700 (PDT) > > I intend to monitor the variable's value (acquired via data acquisition hardware) at a rate of around 1,000 times per second. > I haven't used textboxes before in GTK+. Could anyone suggest how to update the value of a variable in a textbox etc., at this rate. > Thanks, > Adeel > > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > > > > _ > Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problem with continuous image updation in a while loop
In my application, I am implementing status indication (displaying either 'red' or 'green' ) by using Gdkpixmap to assign an image to 'red' or 'green' pixel array. i display or hide the image by calling gtk_widget_show (..) or gtk_widget_hide(..) . The structure of my application is as follows: int main() { 1. Assign Pixmaps --- On Tue, 3/10/09, Jim George wrote: From: Jim George Subject: Re: Continuous variable updation in a text box To: aj...@knac.com Cc: gtk-app-devel-list@gnome.org Date: Tuesday, March 10, 2009, 8:19 PM It wouldn't matter too much, since most screens would only have a refresh rate of 60-120 Hz, which is also much higher than what most people can even see. I've handled such cases by using g_idle_add when I get an update of the variable's status, and have the idle function update the text box. I preserve the event source ID for the next call, and check if that source is still available. If so, I remove the event using g_source_remove and add a new idle event. This way, the most recent update is shown on screen the next time my program goes idle. The idle function then marks the source as free, by setting it to zero. -Jim Ardhan Madras wrote: > So you will need call textbox insertion (update) 1000 times per second or the textbox get updated every 1ms, my question is: Can you see it changes correctly with given cycle? > > --- adeelmali...@yahoo.com wrote: > > From: Adeel Malik > To: > Subject: Continuous variable updation in a text box > Date: Tue, 10 Mar 2009 02:48:15 -0700 (PDT) > > I intend to monitor the variable's value (acquired via data acquisition hardware) at a rate of around 1,000 times per second. > I haven't used textboxes before in GTK+. Could anyone suggest how to update the value of a variable in a textbox etc., at this rate. > Thanks, > Adeel > > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > > > > _ > Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Continuous variable updation in a text box
I intend to monitor the variable's value (acquired via data acquisition hardware) at a rate of around 1,000 times per second. I haven't used textboxes before in GTK+. Could anyone suggest how to update the value of a variable in a textbox etc., at this rate. Thanks, Adeel ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Status Indication GUI development using GTK++
Hi Larry, Thnaks for your reply. As I would be starting the GTK+ development on Fedora Core 6 Linux machine, could please suggest how to install GTK+ on aforesaid machine as I haven't done any software installation on Linux lately and also I couldn't find step-by-step installation instructions in gtk+ tutorial. Also I have couple of questions. 1. Is it possible if I could create the image on a windows machine as a JPEG file and then set those image files to correspond to gtk image widgets after copying the aforesaid jpeg files to the linux machine from the windows machine or I 'ld have to create the images on the linux machine. 2. In the tutorial I couldn't find the reference code to load images as gdkimages and then using gtk_image_set_image. Is there any documentation available on-line that specifically talks about the creation/manipulation of image objects in GTK+. Thanks for your help, Adeel --- On Thu, 1/29/09, Larry Reaves wrote: From: Larry Reaves Subject: Re: Status Indication GUI development using GTK++ To: adeelmali...@yahoo.com Cc: gtk-app-devel-list@gnome.org Date: Thursday, January 29, 2009, 8:36 PM On Thu, 2009-01-29 at 02:56 -0800, Adeel Malik wrote: > Hello, > I have just newly subscribed to thie mailing list and wanted to post a question. > I am doing application development on Fedora Core 6 Linux Machine. I need to implement the status indication GUI such that it could display a simple traffic light indication i.e, green light for success and red light for error. > Can someone suggest me a link where I can get an example code doing thhis type of thing so that I could learn or modify it suit my requirement. > 1. read gtk+ tutorial 2. make window 4. add hbox to window 5. add two gtkImage widgets to the hbox 6. create 4 images: dull red (red light off), bright red (red light on), dull green, bright green 7. load 4 images as gdkImage's 8. use gtk_image_set_image to set the image widgets to the two gdkImage's you want 9. make a function that swaps the state, call this from your other code as necessary There is pretty good documentation out there. Your two best friends will be google and devhelp(an application for gtk+ and related documentation). If you don't have devhelp, you can search library.gnome.org, but devhelp is much more convenient, so I would recommend taking the time to install it. -Larry Reaves > Thnaks for your help and regards, > Adeel Malik > > > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Status Indication GUI development using GTK++
Hello, I have just newly subscribed to thie mailing list and wanted to post a question. I am doing application development on Fedora Core 6 Linux Machine. I need to implement the status indication GUI such that it could display a simple traffic light indication i.e, green light for success and red light for error. Can someone suggest me a link where I can get an example code doing thhis type of thing so that I could learn or modify it suit my requirement. Thnaks for your help and regards, Adeel Malik ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list