Re: Problem with continuous image updation



On Wednesday 18 March 2009, Adeel Malik wrote:

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.

I think this is bad idea using two widgets for your task. Nevertheless
gdk_window_process_updates () call may help just after gtk_widget_show();




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