[cairo] TypeError?

wecing w3cing at gmail.com
Sat Dec 25 20:21:15 PST 2010


I wrote a piece of python code:

> import pygtk

pygtk.require('2.0')

import gtk


> class EggClockFace(gtk.DrawingArea):

    def __init__(self):

        super(EggClockFace, self).__init__()

        self.connect("expose_event", self.expose)

    def expose(self, widget, event):

        context = widget.window.cairo_create()

        # context.translate(event.area.x, event.area.y)

        # context.scale(event.area.width, event.area.height)

        context.rectangle(event.area.x, event.area.y,

                          event.area.width, event.area.height)

        context.clip()

        self.draw(context)

        return False



def main():

    window = gtk.Window()

    clock = EggClockFace()


>     window.add(clock)

    window.connect("destroy", gtk.main_quit)

    window.show_all()


>     gtk.main()


> main()


But what I got though shell was:

> ~/python/cairo/gtk_clock $ python clock1.py

clock1.py:16: DeprecationWarning: use GtkWidget.queue_draw_area

  self.draw(context)

Traceback (most recent call last):

  File "clock1.py", line 16, in expose

    self.draw(context)

TypeError: could not convert to GdkRectangle
>

Why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20101226/1adbac17/attachment.html>


More information about the cairo mailing list