Changes

Jump to navigation Jump to search
no edit summary
Line 77: Line 77:  
=== How do I dynamically set the text in a pango layout? ===
 
=== How do I dynamically set the text in a pango layout? ===
   −
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]]</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]</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.
Anonymous user

Navigation menu