ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/opt/alt/python27/share/doc/alt-python27-pycairo/examples/gtk/ |
Upload File : |
#!/usr/bin/env python
import cairo
import gtk
def expose_event(widget, event):
ctx = widget.window.cairo_create()
ctx.set_line_width(6)
ctx.set_tolerance(.1)
ctx.select_font_face('sans-serif')
ctx.set_font_size(48)
(x, y, width, height, dx, dy) = ctx.text_extents('Hello World')
ctx.translate (100, 100)
ctx.new_path()
ctx.move_to(x-10,y-10)
ctx.rel_line_to(width + 20, 0)
ctx.rel_line_to(0, height + 20)
ctx.rel_line_to(-(width + 20), 0)
ctx.close_path()
ctx.set_source_rgb(0,0,1)
ctx.stroke()
ctx.move_to(0, 0)
ctx.set_source_rgb(0,0,0)
ctx.show_text('Hello World')
win = gtk.Window()
win.connect('destroy', gtk.main_quit)
drawingarea = gtk.DrawingArea()
win.add(drawingarea)
drawingarea.connect('expose_event', expose_event)
drawingarea.set_size_request(400,150)
win.show_all()
gtk.main()