13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

http://www.zetcode.com/wxpython/tips/Figure: undoredo.py#!/usr/bin/python# undoredo.pyfrom wx.lib.sheet import *import wxstockUndo = []stockRedo = []ID_QUIT = 10ID_UNDO = 11ID_REDO = 12ID_EXIT = 13ID_COLSIZE = 80ID_ROWSIZE = 20class UndoText:def __init__(self, sheet, text1, text2, row, column):self.RedoText = text2self.row = rowself.col = columnself.UndoText = text1self.sheet = sheetdef undo(self):self.RedoText = self.sheet.GetCellValue(self.row, self.col)if self.UndoText == None:self.sheetSetCellValue('')else: self.sheet.SetCellValue(self.row, self.col, self.UndoText)def redo(self):if self.RedoText == None:self.sheet.SetCellValue('')else: self.sheet.SetCellValue(self.row, self.col, self.RedoText)class UndoColSize:def __init__(self, sheet, position, size):self.sheet = sheetself.pos = positionself.RedoSize = sizeself.UndoSize = ID_COLSIZEdef undo(self):self.RedoSize = self.sheet.GetColSize(self.pos)self.sheet.SetColSize(self.pos, self.UndoSize)self.sheet.ForceRefresh()6 de 15 27/04/2008 1:09

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!