'Constructor.
Load the sheet from the filename argument.
Set up the Tk widget tree.'

def __init__(self, filename='sheet1.xml', rows=10, columns=5):

    self.filename = filename
    self.sheet = Sheet()
    if os.path.isfile(filename):
        self.sheet.load(filename)
    (maxx, maxy) = self.sheet.getsize()
    rows = max(rows, maxy)
    columns = max(columns, maxx)
    self.root = Tk.Tk()
    self.root.wm_title(('Spreadsheet:    %s' % self.filename))
    self.beacon = Tk.Label(self.root, text='A1', font=('helvetica', 16, 'bold'))
    self.entry = Tk.Entry(self.root)
    self.savebutton = Tk.Button(self.root, text='Save', command=self.save)
    self.cellgrid = Tk.Frame(self.root)
    self.cellgrid.pack(side='bottom', expand=1, fill='both')
    self.beacon.pack(side='left')
    self.savebutton.pack(side='right')
    self.entry.pack(side='left', expand=1, fill='x')
    self.entry.bind('<Return>', self.return_event)
    self.entry.bind('<Shift-Return>', self.shift_return_event)
    self.entry.bind('<Tab>', self.tab_event)
    self.entry.bind('<Shift-Tab>', self.shift_tab_event)
    self.entry.bind('<Delete>', self.delete_event)
    self.entry.bind('<Escape>', self.escape_event)
    self.makegrid(rows, columns)
    self.currentxy = None
    self.cornerxy = None
    self.setcurrent(1, 1)
    self.sync()
