Hello,
I was trying to draw with Cairo on a Content, but nothing shows up. I saw
some examples (included the one in the reference), but I can not see (what
I think are) notable differences.
Here's my code, can you please tell me what I am missing?
Thanks!
#!/usr/bin/env python3
import sys
from gi.repository import Clutter as clu
import cairo
def quit(*args):
clu.main_quit()
def draw_something(canvas, ctx, w, h):
ctx.set_source_rgb(0xff, 0x00, 0xff)
ctx.set_line_width(3)
ctx.move_to(0, 0)
ctx.line_to(w, h)
ctx.stroke()
return True
#def invalidate(canvas):
# canvas.invalidate()
# return True
if __name__ == '__main__':
clu.init(sys.argv)
black = clu.Color.new(0x00, 0x00, 0x00, 0xff)
stage = clu.Stage()
stage.set_color(black)
stage.set_size(200, 200)
stage.connect('destroy', quit)
stage.show()
canvas = clu.Canvas()
canvas.set_size(200, 200)
canvas.connect('draw', draw_something)
stage.set_content(canvas)
# clu.threads_add_timeout(0, 1000, invalidate, canvas)
canvas.invalidate()
clu.main()
~Alessandro
_______________________________________________
clutter-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/clutter-list