Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
Features/GTK3/Porting
(view source)
Revision as of 09:13, 14 November 2011
385 bytes added
,
09:13, 14 November 2011
→Going from Drawable to Cairo
Line 205:
Line 205:
# To invalidate a region to force a refresh, use:
# To invalidate a region to force a refresh, use:
self.canvas.queue_draw_area(x, y, w, h)
self.canvas.queue_draw_area(x, y, w, h)
+
+
# Handle the expose-event by drawing
+
def do_expose_event(self, event):
+
# Create the cairo context
+
cairo_context = self.canvas.get_window().cairo_create(
+
cairo_context.rectangle(event.area.x, event.area.y,
+
event.area.width, event.area.height)
+
cairo_context.clip()
+
cairo_context.set_source_surface(xlib_surface)
+
cairo_context.paint()
</pre>
</pre>
Walter
Bureaucrats
,
Administrators
10,579
edits