Changes

Jump to navigation Jump to search
no edit summary
Line 79: Line 79:  
You will often want to change or reset the text in a pango layout during the life of your activity. To create such dynamic layouts, the main thing you need to do is reset the text or markup for your pango layout (usually using set_markup()) and to then call the queue_draw()<ref>[http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--queue-draw PyGtk Documentation: gtk.Widget.queue_draw]</ref> method which schedules a redraw (effectively forcing an expose_event signal to be thrown).  
 
You will often want to change or reset the text in a pango layout during the life of your activity. To create such dynamic layouts, the main thing you need to do is reset the text or markup for your pango layout (usually using set_markup()) and to then call the queue_draw()<ref>[http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--queue-draw PyGtk Documentation: gtk.Widget.queue_draw]</ref> method which schedules a redraw (effectively forcing an expose_event signal to be thrown).  
   −
The code below uses a standard timeout code pattern<ref>[http://wiki.laptop.org/go/PyGTK/Smooth_Animation_with_PyGTK#Timer_Events]</ref> to call a method every 1 second. So the text in the Pango is updated to give the current time roughly every 1 second.
+
The code below uses a standard timeout code pattern<ref>[http://wiki.laptop.org/go/PyGTK/Smooth_Animation_with_PyGTK#Timer_Events PyGtk/Smooth Animation: Timer Objects]</ref> to call a method every 1 second. So the text in the Pango is updated to give the current time roughly every 1 second.
    
<pre>
 
<pre>
Anonymous user

Navigation menu