30 lines
721 B
Python
30 lines
721 B
Python
#! /usr/bin/python
|
|
|
|
# To change this template, choose Tools | Templates
|
|
# and open the template in the editor.
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Jan 6, 2010 9:55:39 PM$"
|
|
|
|
|
|
import gtk
|
|
|
|
class Button(gtk.Button):
|
|
def __init__(self,name,func,image=None,text=None):
|
|
gtk.Button.__init__(self)
|
|
box = gtk.HBox(True,0)
|
|
# Add an image if we were given one
|
|
if image!= None:
|
|
box.pack_start(image,True,True,0)
|
|
# Add text if we were given some
|
|
if text != None:
|
|
label = gtk.Label(text)
|
|
label.set_line_wrap(True)
|
|
label.set_size_request(100,100)
|
|
label.show()
|
|
box.pack_start(label,True,True,0)
|
|
# Show and add callback function
|
|
box.show()
|
|
self.add(box)
|
|
self.connect("clicked",func,name)
|
|
self.show() |