# Simplifying the previous example,
#        by subclassing to make a line of buttons widget

from Tkinter import *

def report():
	print "A button has been pressed"

class ButtonLine(Frame):

	def __init__(self, master, button_data):
		Frame.__init__(self, master)
		for text, command in button_data:
			Button(self, text=text, command=command).pack(side=LEFT)

outer_frame = Frame(None)
outer_frame.pack()

first_line = ButtonLine(outer_frame, [('Button 1', report),
				      ('Button 2', report)])
first_line.pack(side=TOP)

second_line = ButtonLine(outer_frame, [('Button 3', report),
				       ('Button 4', report)])
second_line.pack(side=TOP)

outer_frame.mainloop()
