from pytk2 import * class NewApp(App): def __init__(self,root,sizeX,sizeY,title): App.__init__(self,root,sizeX,sizeY,title) def Run(self): self.graph = NewGraph(self.root,self.sizeX,self.sizeY) menu = GrMenu(self.root,self.graph) self.graph.Run() class NewGraph(Graph): def __init__(self,root,maxX,maxY): Graph.__init__(self,root,maxX,maxY) def Run(self): self.lastX,self.lastY = 0,0 self.canv.tag_bind('point','<1>',self.plotDown) self.canv.tag_bind('point','Button-Release-1',self.bindRelease) self.canv.tag_bind('point','',self.plotMove) def bindRelease(self,event): self.canv.drag('selected') def plotDown(self,event): self.canv.dtag('selected') self.canv.addtag_withtag('selected','current') self.canv.tag_raise('current') self.lastX,self.lastY = event.x,event.y def plotMove(self,event): self.canv.move('selected',event.x-self.lastX,event.y-self.lastY) self.lastX,self.lastY = event.x,event.y