本文整理汇总了Python中Model.Model.join方法的典型用法代码示例。如果您正苦于以下问题:Python Model.join方法的具体用法?Python Model.join怎么用?Python Model.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model.Model
的用法示例。
在下文中一共展示了Model.join方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Application
# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import join [as 别名]
class Application(ttk.Frame):
def __init__(self,parent,**kwargs):
# Init
self.parent = parent
ttk.Frame.__init__(self,parent,**kwargs)
# Init configuration
ttk.Style().configure("BW.TLabel")
ttk.Style().configure("BW.TButton")
# Create Model
self.model = Model()
# COM Frame
self.frame_com_ports = COM_Frame(self,self.model,relief=Tk.GROOVE)
self.frame_com_ports.grid(column=0,row=0,sticky='NSEW',pady=2,padx=5)
# Logger frame
self.frame_logger = Logger_Frame(self,self.model,bd=2,relief=Tk.GROOVE)
self.frame_logger.grid(column=0,row=1,sticky='NSEW',pady=2,padx=5)
# Graph 1 frame
self.frame_graph1 = Plot2D_Frame(self,self.model,self.parent,bd=2,relief=Tk.GROOVE)
self.frame_graph1.grid(column=1,row=0,sticky='EW',pady=2,padx=0,rowspan=2)
# Graph 2 frame
self.frame_graph2 = Plot2D_Frame(self,self.model,self.parent,bd=2,relief=Tk.GROOVE)
self.frame_graph2.grid(column=2,row=0,sticky='EW',pady=2,padx=0,rowspan=2)
# Quit button
self.bouton_quitter = Tk.Button(self, text="QUITTER",command = self.stop)
self.bouton_quitter.grid(column=0,row=2,sticky='EW',pady=2,padx=5)
self.model.start()
def stop(self):
self.model.stop()
if self.model.isAlive():
self.model.join(0.1)
if self.model.isAlive():
self.model.join(1)
if self.model.isAlive():
print("--- Model thread not properly joined.")
self.parent.destroy()
示例2: fake_data_received
# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import join [as 别名]
time.sleep(1.0)
# Immediate erase sequence
# (If erase happens before 500 ms
# no start to avoid querying variables to quickly to the MCU)
pub.sendMessage('using_var',varid=2)
pub.sendMessage('stop_using_var',varid=2)
time.sleep(1.0)
# Late MCU answer sequence
pub.sendMessage('using_var',varid=3)
time.sleep(3.0)
fake_data_received(3)
pub.sendMessage('stop_using_var',varid=3)
# Multiple readers sequence
pub.sendMessage('using_var',varid=5)
time.sleep(1.0)
fake_data_received(5)
time.sleep(1.0)
pub.sendMessage('using_var',varid=5)
time.sleep(1.0)
pub.sendMessage('stop_using_var',varid=5)
time.sleep(1.0)
pub.sendMessage('stop_using_var',varid=5)
time.sleep(1.0)
model.stop()
model.join()
print("Done.")
示例3: Application
# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import join [as 别名]
class Application(ttk.Frame):
def __init__(self,parent,**kwargs):
# Init
self.parent = parent
ttk.Frame.__init__(self,parent,**kwargs)
# Init configuration
ttk.Style().configure("BW.TLabel")
ttk.Style().configure("BW.TButton")
self.grid(row=0,column=0,sticky="WENS")
# Create Model
self.model = Model()
# COM Frame
self.frame_com_ports = COM_Frame(self,self.model,relief=Tk.GROOVE)
self.frame_com_ports.grid(column=0,row=0,sticky='NSEW',pady=2,padx=5)
# Logger frame
self.frame_logger = Logger_Frame(self,self.model,bd=2,relief=Tk.GROOVE)
self.frame_logger.grid(column=0,row=1,sticky='NSEW',pady=2,padx=5)
# Graph 1 frame
# self.frame_graph1 = Plot2D_Frame(self,self.model,self.parent,bd=2,relief=Tk.GROOVE)
# self.frame_graph1.grid(column=1,row=0,sticky='EW',pady=2,padx=0,rowspan=2)
# Graph 2 frame
# self.frame_graph2 = Plot2D_Frame(self,self.model,self.parent,bd=2,relief=Tk.GROOVE)
# self.frame_graph2.grid(column=2,row=0,sticky='EW',pady=2,padx=0,rowspan=2)
# Quit button
self.bouton_quitter = Tk.Button(self, text="QUITTER",command = self.stop)
self.bouton_quitter.grid(column=0,row=2,sticky='EW',pady=2,padx=5)
#redimensionnement
self.parent.grid_columnconfigure(0,weight=1)
self.parent.grid_rowconfigure(0,weight=1)
self.grid_rowconfigure(1,weight=2)
self.parent.minsize(width=350, height=500)
self.model.start()
# Subsciptions
pub.subscribe(self.listener_valPlot,"plot_var")
def stop(self):
self.model.stop()
if self.model.isAlive():
self.model.join(0.1)
if self.model.isAlive():
self.model.join(1)
if self.model.isAlive():
print("--- Model thread not properly joined.")
self.parent.destroy()
def listener_valPlot(self):
self.plot = Tk.Toplevel()
self.Plot_frm = Plot2D_Frame(self.plot,self.model, self.plot)
self.plot.minsize(width=300, height=200)
try:
self.frame_logger.variable_selected(None)
self.Plot_frm.add_var_to_plot()
except:
print("err1")