def __init__(self, cols, rows, value, width, height, widthMM, heightMM, title, menu = None, keybindings = []): """ TkMap extends Map and Tkinter """ Map.__init__(self, cols, rows, widthMM, heightMM) Tkinter.Tk.__init__(self) self.title(title) if menu == None: menu = [('File',[['Exit',self.destroy]])] keybindings.append( ("<Configure>", self.changeSize)) self.menuButtons = {} self.debug = 0 self.application = 0 self.width = width self.height = height self.colScale = self.width / self.cols self.rowScale = self.height / self.rows self.addMenu(menu) self.frame = Tkinter.Frame(self,relief=Tkinter.RAISED,borderwidth=2) self.frame.pack(side = "top", expand = "yes", fill = "both") self.canvas = Tkinter.Canvas(self.frame,width=self.width,height=self.height) self.canvas.pack(side = "top", expand = "yes", fill = "both") self.addKeyBindings(keybindings) self.protocol('WM_DELETE_WINDOW', self.destroy) self.update_idletasks() self.canvas.focus_set() self.canvas_width_diff = int(self.winfo_width()) - int(self.canvas["width"]) self.canvas_height_diff = int(self.winfo_height()) - int(self.canvas["height"])
def setGrid(self, grid): Map.setGrid(self, grid) self.changeSize()