Skip to content

@wolfv /bgimage-python-gtk3.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Python GTK 3 Pattern Tiling
#!/usr/bin/env python
from gi.repository import Gtk, Gdk
import cairo
def draw_background( widget, context):
surface = cairo.ImageSurface.create_from_png('bg.png')
sp = cairo.SurfacePattern(surface)
sp.set_extend(cairo.EXTEND_REPEAT)
context.set_source(sp)
context.paint()
window = Gtk.Window()
window.set_title('Drawing Test')
window.set_size_request(640,480)
window.connect('destroy',Gtk.main_quit)
hbbox = Gtk.HButtonBox()
window.add(hbbox)
hbbox.connect('draw', draw_background)
button = Gtk.Button('Press Me!')
hbbox.pack_start(button, True, False, 10)
window.show_all()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.