Skip to content

Instantly share code, notes, and snippets.

@brodock
Created May 6, 2009 13:00
Show Gist options
  • Save brodock/107508 to your computer and use it in GitHub Desktop.
Save brodock/107508 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import gtk
class TinyButton(gtk.ToolButton):
'''a simple and tiny button'''
def __init__(self, stock):
'''constructor'''
gtk.ToolButton.__init__(self)
self.image = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU)
self.set_icon_widget(self.image)
width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
self.set_size_request(width + 2, height + 2)
self.image.show()
if __name__ == '__main__':
w = gtk.Window()
w.add(TinyButton(gtk.STOCK_CLOSE))
w.show_all()
gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment