本文整理汇总了Python中matplotlib.backends.backend_tkagg.FigureCanvasTkAgg.new_timer方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasTkAgg.new_timer方法的具体用法?Python FigureCanvasTkAgg.new_timer怎么用?Python FigureCanvasTkAgg.new_timer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_tkagg.FigureCanvasTkAgg
的用法示例。
在下文中一共展示了FigureCanvasTkAgg.new_timer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HumanActivityInterface
# 需要导入模块: from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg [as 别名]
# 或者: from matplotlib.backends.backend_tkagg.FigureCanvasTkAgg import new_timer [as 别名]
class HumanActivityInterface(object):
def __init__(self,master):
self.myParent = master
width=self.myParent.winfo_screenwidth()
height=self.myParent.winfo_screenheight()
self.myParent.geometry(("%dx%d")%(width,height))
self.myParent.title("Video Analysis")
self.myContainer = Frame(master)
self.myContainer.grid()
self.coefficientLabel = Label(self.myContainer,text = 'Coefficient',takefocus=0)
self.coefficientLabel.grid(row=1,sticky=S+W,padx=10,pady=20)
self.coefficientEntry = Entry(self.myContainer,width=32)
self.coefficientEntry.grid(row=1,column=1,sticky=S+W,padx=10,pady=20)
self.buttonCalculate = Button(self.myContainer,bg='light blue')
self.buttonCalculate["text"] = "Calculate"
self.buttonCalculate.grid(row=1,column=2,sticky=S+W,padx=10,pady=20)
self.buttonCalculate.bind("<Key>",self.videoStart)
self.buttonTrain = Button(self.myContainer,text='Train',bg='light blue' ,width=5)
self.buttonTrain.grid(row=17,column = 0,sticky=S+E)
self.buttonStop = Button(self.myContainer,text='Stop',bg='light blue' ,width=5)
self.buttonStop.grid(row=17,column=3,sticky=N+W,pady=10)
self.buttonStop.bind("<Key>",self.videoStop)
self.buttonExit = Button(self.myContainer,text='Exit',bg='light blue' ,width=5,command=self.exitForm)
self.buttonExit.grid(row=17,column=6,sticky=N+E,pady=10)
self.countourFig= figure(figsize=(4,4),dpi = 130)
self.countourAxis = self.countourFig.add_subplot(111)
self.countourAxis.set_title('Event detection')
self.countourAxis.set_axis_off()
self.countourCanvas = FigureCanvasTkAgg(self.countourFig,master=self.myContainer)
self.countourCanvas.get_tk_widget().grid(row=2,column=3,columnspan=4,rowspan=15)
self.videoFig = figure(figsize=(4,4), dpi=80)
self.videoAxis = self.videoFig.add_subplot(111)
self.videoAxis.set_title('Video')
self.videoAxis.set_axis_off()
self.videoCanvas = FigureCanvasTkAgg(self.videoFig, master=self.myContainer)
self.videoCanvas.get_tk_widget().grid(row=2,columnspan=2,rowspan=4)
self.timer = self.videoCanvas.new_timer(interval=10)
#~ self.cFrame = Frame(self.myContainer)
#~ self.cFrame.grid(row=8,columnspan=2,rowspan=3)
self.dataFig = figure(figsize=(4,3))
self.dataAxis=self.dataFig.gca()
self.dataAxis.set_axis_off()
self.dataCanvas = FigureCanvasTkAgg(self.dataFig, master=self.myContainer)
self.dataCanvas.get_tk_widget().grid(row=8,columnspan=2,rowspan=3)
#~ self.vscrollbar=Scrollbar(self.cFrame,orient=VERTICAL)
#~ self.vscrollbar.grid(sticky=E)
self.eventLabel = Label(self.myContainer,text = 'Events:-')
self.eventLabel.grid(row=1,column=6,columnspan=3)
def videoStart(self,event):
if (str(event.keysym) == 'Return') | (str(event.keysym) == 'space'):
self.timer.start()
def videoStop(self,event):
if (str(event.keysym) == 'Return') | (str(event.keysym) == 'space'):
self.timer.stop()
def exitForm(self):
self.cap.release()
self.myParent.destroy()
示例2: HumanActivityInterface
# 需要导入模块: from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg [as 别名]
# 或者: from matplotlib.backends.backend_tkagg.FigureCanvasTkAgg import new_timer [as 别名]
class HumanActivityInterface(object):
def __init__(self,master):
self.myParent = master
width=self.myParent.winfo_screenwidth()
height=self.myParent.winfo_screenheight()
self.myParent.geometry(("%dx%d")%(width,height))
self.myParent.title("Video Analysis")
self.myContainer = Frame(master,background="white")
self.myContainer.grid()
self.videoFig = figure(figsize=(4,4), dpi=80)
self.videoAxis = self.videoFig.add_subplot(111)
self.videoAxis.set_title('xn - Video')
self.videoAxis.set_axis_off()
self.videoCanvas = FigureCanvasTkAgg(self.videoFig, master=self.myContainer)
self.videoCanvas.get_tk_widget().grid(row=0,columnspan=2)
self.videoCanvas.show()
self.timer = self.videoCanvas.new_timer(interval=10)
self.differenceFig = figure(figsize=(4,4),dpi = 80)
self.differenceAxis = self.differenceFig.add_subplot(111)
self.differenceAxis.set_title('xn-yn')
self.differenceAxis.set_axis_off()
self.differenceCanvas = FigureCanvasTkAgg(self.differenceFig,master=self.myContainer)
self.differenceCanvas.get_tk_widget().grid(row=0,column=2,columnspan=3,pady=10)
self.differenceCanvas.show()
self.coefficientLabel = Label(self.myContainer,text = 'Coefficient')
self.coefficientLabel.grid(row=3,sticky=S+W)
self.coefficientEntry = Entry(self.myContainer,width=32)
self.coefficientEntry.grid(row=3,column=1,sticky=S+W,columnspan=1)
self.buttonCalculate = Button(self.myContainer,bg='light blue')
self.buttonCalculate["text"] = "Calculate"
self.buttonCalculate.grid(row=4,column=1,sticky=N+W)
self.buttonCalculate.bind("<Button-1>",self.videoStart)
self.buttonStop = Button(self.myContainer,text='Stop',bg='light blue' ,width=5)
self.buttonStop.grid(row=4,column=1,sticky=N+E)
self.buttonStop.bind("<Button-1>",self.videoStop)
self.backgroundFig= figure(figsize=(4,4),dpi = 80)
self.backgroundAxis = self.backgroundFig.add_subplot(111)
self.backgroundAxis.set_title('yn - Background')
self.backgroundAxis.set_axis_off()
self.backgroundCanvas = FigureCanvasTkAgg(self.backgroundFig,master=self.myContainer)
self.backgroundCanvas.get_tk_widget().grid(row=1,rowspan = 6,column=2,columnspan=3,pady=10)
self.backgroundCanvas.show()
self.countourFig= figure(figsize=(4,4),dpi = 80)
self.countourAxis = self.countourFig.add_subplot(111)
self.countourAxis.set_title('Event detection')
self.countourAxis.set_axis_off()
self.countourCanvas = FigureCanvasTkAgg(self.countourFig,master=self.myContainer)
self.countourCanvas.get_tk_widget().grid(row=0,column=6,columnspan=3,pady=10)
self.countourCanvas.show()
self.eventLabel = Label(self.myContainer,text = 'Events:-')
self.eventLabel.grid(row=1,column=6,columnspan=3)
def videoStart(self,event):
self.timer.start()
def videoStop(self,event):
self.timer.stop()