"""The view module shows the GUI for the counters."""
from Tkinter import *
import CounterButton  # this module holds the controller class we wrote

myfont = ("Arial", 16, "bold")
HOW_MANY = 8

window = Tk()
window.title("Lots of counters")

width = HOW_MANY * 100
window.geometry(str(width) + "x120")

frame = Frame(window)
frame.grid()

# Construct the buttons and controllers and connect them:
for i in range(HOW_MANY) :

    button = Button(frame, font = myfont, text = "0",
                    fg = "blue",  bg = "white", width = 4, height = 2)
    button.grid(row = 1, column = i, padx = 10, pady = 10 )

    # use  class Control, the class coded in  module CounterButton,
    #   to construct new a controller object:
    controller = CounterButton.Control(button)

    # connect the controller's  handle  function as the event handler:
    button.configure(command = controller.handle)

window.mainloop()