Skip to content

Instantly share code, notes, and snippets.

@cadet23
Created October 14, 2016 17:14
Show Gist options
  • Save cadet23/bf81436c28f1d43be2b10463b4bf194d to your computer and use it in GitHub Desktop.
Save cadet23/bf81436c28f1d43be2b10463b4bf194d to your computer and use it in GitHub Desktop.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GdkPixbuf
class Application(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Application")
self.set_default_size(50, 200)
grid = Gtk.Grid()
self.add(grid)
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale("s.png", 50, 35, 1)
image = Gtk.Image()
image.set_from_pixbuf(pixbuf)
button = Gtk.Button(image=image)
grid.attach(button, 1, 1, 1, 1)
app = Application()
app.connect("delete-event", Gtk.main_quit)
app.show_all()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment