I'm making an app to read cards and then print its balance, when user wants to see his balance he clicks on Balance Enquiry button on main screen. I've created the background using Cairo. Now when user click Balance Enquiry
the screen showing show your card
should be paused for 2-3 seconds, So I'm using sleep() function. But the problem is the screen sleeps on click on Bal. Enq.
button, I'm sure that the sleep()
is after the code that prints show ur card
on screen.
how to use sleep() in GTK+
3.8k views Asked by nitin kumar At
1
You can't use
sleep()
in a GTK+ GUI application, it will block the entire application and make it unresponsive. It is your application that causes GTK+ to do the work to update the interface; if you sleep, you stop GTK+ from running and thus the UI changes won't happen until the application wakes back up.Look into glib's timeout API:
g_timeout_add()
is a sensible place to start.