Created
August 25, 2012 20:51
-
-
Save wolfv/3470841 to your computer and use it in GitHub Desktop.
Python GTK 3 Pattern Tiling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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