[cairo-commit] pycairo/examples/gtk hangman.py, 1.8, 1.9 cairo-demo.py, 1.8, 1.9 cairo-knockout.py, 1.12, 1.13

Steve Chaplin commit at pdx.freedesktop.org
Fri Jan 20 03:15:23 PST 2006


Committed by: stevech1097

Update of /cvs/cairo/pycairo/examples/gtk
In directory gabe:/tmp/cvs-serv14819/examples/gtk

Modified Files:
	hangman.py cairo-demo.py cairo-knockout.py 
Log Message:
'SC'

Index: hangman.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/hangman.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- hangman.py	29 Aug 2005 02:31:20 -0000	1.8
+++ hangman.py	20 Jan 2006 11:15:21 -0000	1.9
@@ -57,8 +57,7 @@
         widget.queue_draw()
 
 def expose_event(widget, event):
-    width  = widget.allocation.width
-    height = widget.allocation.height
+    _, _, width, height = widget.allocation
 
     if width < height:
         size = width
@@ -67,15 +66,15 @@
 
     pixmap = gtk.gdk.Pixmap (widget.window, width, height)
 
-    if gtk.pygtk_version >= (2,7,0):
-        ctx = pixmap.cairo_create()
-    else:
+    if gtk.pygtk_version < (2,7,0):
         ctx = cairo.gtk.gdk_cairo_create(pixmap)
+    else:
+        ctx = pixmap.cairo_create()
 
     # set the background
     ctx.set_source_rgb(0.7,0.7,0.7)
-    ctx.rectangle(0,0,width, height)
-    ctx.fill()
+    ctx.set_operator (cairo.OPERATOR_SOURCE)
+    ctx.paint()
 
     ctx.translate ((width - size) / 2, (height - size) / 2)
     ctx.scale(size / 150.0, size / 160.0)

Index: cairo-demo.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/cairo-demo.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo-demo.py	29 Aug 2005 02:31:19 -0000	1.8
+++ cairo-demo.py	20 Jan 2006 11:15:21 -0000	1.9
@@ -80,12 +80,10 @@
     draw_shapes(ctx, x, y, False)
 
 def expose (da, event):
-    x, y, width, height = da.allocation
-
-    if gtk.pygtk_version >= (2,7,0):
-        ctx = da.window.cairo_create()
-    else:
+    if gtk.pygtk_version < (2,7,0):
         ctx = cairo.gtk.gdk_cairo_create(da.window)
+    else:
+        ctx = da.window.cairo_create()
 
     ctx.set_source_rgb(0, 0, 0)
 

Index: cairo-knockout.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/cairo-knockout.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cairo-knockout.py	29 Aug 2005 02:31:20 -0000	1.12
+++ cairo-knockout.py	20 Jan 2006 11:15:21 -0000	1.13
@@ -106,12 +106,13 @@
     ctx.paint()
 
 def expose(drawingarea, event):
-    if gtk.pygtk_version >= (2,7,0):
-        ctx = drawingarea.window.cairo_create()
-    else:
+    if gtk.pygtk_version < (2,7,0):
         ctx = cairo.gtk.gdk_cairo_create(drawingarea.window)
+    else:
+        ctx = drawingarea.window.cairo_create()
 
-    draw (ctx, drawingarea.allocation.width, drawingarea.allocation.height)
+    _, _, width, height = drawingarea.allocation
+    draw (ctx, width, height)
 
     return False
 



More information about the cairo-commit mailing list