'Fill the GUI cells from the sheet cells.'

def sync(self):

    self.sheet.recalc()
    for ((x, y), gridcell) in self.gridcells.items():
        if ((x == 0) or (y == 0)):
            continue
        cell = self.sheet.getcell(x, y)
        if (cell is None):
            gridcell['text'] = ''
        else:
            if hasattr(cell, 'format'):
                (text, alignment) = cell.format()
            else:
                (text, alignment) = (str(cell), LEFT)
            gridcell['text'] = text
            gridcell['anchor'] = align2anchor[alignment]
