def vp_start_gui(): '''Starting point when module is the main routine.''' global val, w, root root = Tk() root.title('SH_Mobot_Configuration') geom = "736x584+690+108" root.geometry(geom) UI_Mobot_Configuration_support.set_Tk_var() w = SH_Mobot_Configuration (root) UI_Mobot_Configuration_support.init(root, w) root.mainloop()
def create_SH_Mobot_Configuration(root, param=None): '''Starting point when module is imported by another program.''' global w, w_win, rt rt = root w = Toplevel (root) w.title('SH_Mobot_Configuration') geom = "736x584+690+108" w.geometry(geom) UI_Mobot_Configuration_support.set_Tk_var() w_win = SH_Mobot_Configuration (w) UI_Mobot_Configuration_support.init(w, w_win, param) return w_win
def __init__(self, master=None): _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.',background=_bgcolor) self.style.configure('.',foreground=_fgcolor) self.style.configure('.',font="TkDefaultFont") self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) master.configure(background="#d9d9d9") master.configure(highlightbackground="#d9d9d9") master.configure(highlightcolor="black") self.Label2 = Label(master) self.Label2.place(relx=0.01, rely=0.33, height=24, width=65) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background=_bgcolor) self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(justify=RIGHT) self.Label2.configure(text='''Blur''') self.Label3 = Label(master) self.Label3.place(relx=0.01, rely=0.39, height=24, width=67) self.Label3.configure(activebackground="#f9f9f9") self.Label3.configure(activeforeground="black") self.Label3.configure(background=_bgcolor) self.Label3.configure(disabledforeground="#a3a3a3") self.Label3.configure(foreground="#000000") self.Label3.configure(highlightbackground="#d9d9d9") self.Label3.configure(highlightcolor="black") self.Label3.configure(justify=RIGHT) self.Label3.configure(text='''Canny Lo''') self.Label4 = Label(master) self.Label4.place(relx=0.01, rely=0.46, height=24, width=63) self.Label4.configure(activebackground="#f9f9f9") self.Label4.configure(activeforeground="black") self.Label4.configure(background=_bgcolor) self.Label4.configure(disabledforeground="#a3a3a3") self.Label4.configure(foreground="#000000") self.Label4.configure(highlightbackground="#d9d9d9") self.Label4.configure(highlightcolor="black") self.Label4.configure(justify=RIGHT) self.Label4.configure(text='''Canny Hi''') self.Label5 = Label(master) self.Label5.place(relx=0.01, rely=0.53, height=24, width=63) self.Label5.configure(activebackground="#f9f9f9") self.Label5.configure(activeforeground="black") self.Label5.configure(background=_bgcolor) self.Label5.configure(disabledforeground="#a3a3a3") self.Label5.configure(foreground="#000000") self.Label5.configure(highlightbackground="#d9d9d9") self.Label5.configure(highlightcolor="black") self.Label5.configure(justify=RIGHT) self.Label5.configure(text='''Saturation''') self.Label6 = Label(master) self.Label6.place(relx=0.01, rely=0.6, height=24, width=63) self.Label6.configure(activebackground="#f9f9f9") self.Label6.configure(activeforeground="black") self.Label6.configure(background=_bgcolor) self.Label6.configure(disabledforeground="#a3a3a3") self.Label6.configure(foreground="#000000") self.Label6.configure(highlightbackground="#d9d9d9") self.Label6.configure(highlightcolor="black") self.Label6.configure(justify=RIGHT) self.Label6.configure(text='''Brightness''') self.Labelframe1 = LabelFrame(master) self.Labelframe1.place(relx=0.03, rely=0.02, relheight=0.25 , relwidth=0.52) self.Labelframe1.configure(relief=GROOVE) self.Labelframe1.configure(foreground="black") self.Labelframe1.configure(text='''Connection''') self.Labelframe1.configure(background=_bgcolor) self.Labelframe1.configure(highlightbackground="#d9d9d9") self.Labelframe1.configure(highlightcolor="black") self.Labelframe1.configure(width=380) self.Label7 = Label(self.Labelframe1) self.Label7.place(relx=0.03, rely=0.14, height=24, width=53) self.Label7.configure(activebackground="#f9f9f9") self.Label7.configure(activeforeground="black") self.Label7.configure(background=_bgcolor) self.Label7.configure(disabledforeground="#a3a3a3") self.Label7.configure(foreground="#000000") self.Label7.configure(highlightbackground="#d9d9d9") self.Label7.configure(highlightcolor="black") self.Label7.configure(text='''IP ADDR''') self.Label8 = Label(self.Labelframe1) self.Label8.place(relx=0.03, rely=0.34, height=24, width=53) self.Label8.configure(activebackground="#f9f9f9") self.Label8.configure(activeforeground="black") self.Label8.configure(background=_bgcolor) self.Label8.configure(disabledforeground="#a3a3a3") self.Label8.configure(foreground="#000000") self.Label8.configure(highlightbackground="#d9d9d9") self.Label8.configure(highlightcolor="black") self.Label8.configure(text='''PORT''') self.IPEntry = Entry(self.Labelframe1) self.IPEntry.place(relx=0.18, rely=0.14, relheight=0.14, relwidth=0.77) self.IPEntry.configure(background="white") self.IPEntry.configure(disabledforeground="#a3a3a3") self.IPEntry.configure(font="TkFixedFont") self.IPEntry.configure(foreground="#000000") self.IPEntry.configure(highlightbackground="#d9d9d9") self.IPEntry.configure(highlightcolor="black") self.IPEntry.configure(insertbackground="black") self.IPEntry.configure(selectbackground="#c4c4c4") self.IPEntry.configure(selectforeground="black") self.PortEntry = Entry(self.Labelframe1) self.PortEntry.place(relx=0.18, rely=0.34, relheight=0.14, relwidth=0.77) self.PortEntry.configure(background="white") self.PortEntry.configure(disabledforeground="#a3a3a3") self.PortEntry.configure(font="TkFixedFont") self.PortEntry.configure(foreground="#000000") self.PortEntry.configure(highlightbackground="#d9d9d9") self.PortEntry.configure(highlightcolor="black") self.PortEntry.configure(insertbackground="black") self.PortEntry.configure(selectbackground="#c4c4c4") self.PortEntry.configure(selectforeground="black") self.PingButton = ttk.Button(self.Labelframe1) self.PingButton.place(relx=0.76, rely=0.55, height=25, width=76) self.PingButton.configure(command=UI_Mobot_Configuration_support.pingAction) self.PingButton.configure(takefocus="") self.PingButton.configure(text='''Ping''') self.ConnectButton = ttk.Button(self.Labelframe1) self.ConnectButton.place(relx=0.76, rely=0.76, height=25, width=76) self.ConnectButton.configure(command=UI_Mobot_Configuration_support.connectAction) self.ConnectButton.configure(takefocus="") self.ConnectButton.configure(text='''Connect''') self.Labelframe2 = LabelFrame(master) self.Labelframe2.place(relx=0.57, rely=0.02, relheight=0.25 , relwidth=0.38) self.Labelframe2.configure(relief=GROOVE) self.Labelframe2.configure(foreground="black") self.Labelframe2.configure(text='''System Status''') self.Labelframe2.configure(background=_bgcolor) self.Labelframe2.configure(highlightbackground="#d9d9d9") self.Labelframe2.configure(highlightcolor="black") self.Labelframe2.configure(width=280) self.TProgressbar1 = ttk.Progressbar(self.Labelframe2) self.TProgressbar1.place(relx=0.07, rely=0.34, relwidth=0.86 , relheight=0.0, height=22) self.Label1 = Label(self.Labelframe2) self.Label1.place(relx=0.07, rely=0.14, height=21, width=46) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(activeforeground="black") self.Label1.configure(background=_bgcolor) self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(foreground="#000000") self.Label1.configure(highlightbackground="#d9d9d9") self.Label1.configure(highlightcolor="black") self.Label1.configure(text='''Battery:''') self.Label9 = Label(self.Labelframe2) self.Label9.place(relx=0.25, rely=0.14, height=21, width=57) self.Label9.configure(activebackground="#f9f9f9") self.Label9.configure(activeforeground="black") self.Label9.configure(background=_bgcolor) self.Label9.configure(disabledforeground="#a3a3a3") self.Label9.configure(foreground="#000000") self.Label9.configure(highlightbackground="#d9d9d9") self.Label9.configure(highlightcolor="black") self.Label9.configure(justify=LEFT) self.Label9.configure(text='''Unknown''') self.Label10 = Label(self.Labelframe2) self.Label10.place(relx=0.07, rely=0.55, height=21, width=94) self.Label10.configure(activebackground="#f9f9f9") self.Label10.configure(activeforeground="black") self.Label10.configure(background=_bgcolor) self.Label10.configure(disabledforeground="#a3a3a3") self.Label10.configure(foreground="#000000") self.Label10.configure(highlightbackground="#d9d9d9") self.Label10.configure(highlightcolor="black") self.Label10.configure(text='''System Integrity:''') self.Label11 = Label(self.Labelframe2) self.Label11.place(relx=0.43, rely=0.55, height=21, width=57) self.Label11.configure(activebackground="#f9f9f9") self.Label11.configure(activeforeground="black") self.Label11.configure(background=_bgcolor) self.Label11.configure(disabledforeground="#a3a3a3") self.Label11.configure(foreground="#000000") self.Label11.configure(highlightbackground="#d9d9d9") self.Label11.configure(highlightcolor="black") self.Label11.configure(justify=LEFT) self.Label11.configure(text='''Unknown''') self.Label12 = Label(self.Labelframe2) self.Label12.place(relx=0.07, rely=0.76, height=21, width=89) self.Label12.configure(activebackground="#f9f9f9") self.Label12.configure(activeforeground="black") self.Label12.configure(background=_bgcolor) self.Label12.configure(disabledforeground="#a3a3a3") self.Label12.configure(foreground="#000000") self.Label12.configure(highlightbackground="#d9d9d9") self.Label12.configure(highlightcolor="black") self.Label12.configure(text='''Signal Strength:''') self.Label13 = Label(self.Labelframe2) self.Label13.place(relx=0.43, rely=0.76, height=21, width=57) self.Label13.configure(activebackground="#f9f9f9") self.Label13.configure(activeforeground="black") self.Label13.configure(background=_bgcolor) self.Label13.configure(disabledforeground="#a3a3a3") self.Label13.configure(foreground="#000000") self.Label13.configure(highlightbackground="#d9d9d9") self.Label13.configure(highlightcolor="black") self.Label13.configure(justify=LEFT) self.Label13.configure(text='''Unknown''') self.BlurScale = ttk.Scale(master) self.BlurScale.place(relx=0.11, rely=0.33, relwidth=0.39, relheight=0.0 , height=26) self.BlurScale.configure(to="50") self.BlurScale.configure(takefocus="") self.BlurScale.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.CannyLoScale = ttk.Scale(master) self.CannyLoScale.place(relx=0.11, rely=0.39, relwidth=0.39 , relheight=0.0, height=26) self.CannyLoScale.configure(to="300") self.CannyLoScale.configure(takefocus="") self.CannyLoScale.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.CannyHiScale = ttk.Scale(master) self.CannyHiScale.place(relx=0.11, rely=0.46, relwidth=0.39 , relheight=0.0, height=26) self.CannyHiScale.configure(to="300") self.CannyHiScale.configure(takefocus="") self.CannyHiScale.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.SaturationScale = ttk.Scale(master) self.SaturationScale.place(relx=0.11, rely=0.53, relwidth=0.39 , relheight=0.0, height=26) self.SaturationScale.configure(to="100") self.SaturationScale.configure(takefocus="") self.SaturationScale.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.BrightnessScale = ttk.Scale(master) self.BrightnessScale.place(relx=0.11, rely=0.6, relwidth=0.39 , relheight=0.0, height=26) self.BrightnessScale.configure(to="100") self.BrightnessScale.configure(takefocus="") self.BrightnessScale.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.ApplyButton = ttk.Button(master) self.ApplyButton.place(relx=0.52, rely=0.6, height=25, width=76) self.ApplyButton.configure(command=UI_Mobot_Configuration_support.applyAction) self.ApplyButton.configure(takefocus="") self.ApplyButton.configure(text='''Apply''') self.ApplyButton.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.style.map('TCheckbutton',background= [('selected', _bgcolor), ('active',_ana2color)]) self.MedianBlurCheck = ttk.Checkbutton(master) self.MedianBlurCheck.place(relx=0.52, rely=0.33, relwidth=0.12 , relheight=0.0, height=21) self.MedianBlurCheck.configure(variable=UI_Mobot_Configuration_support.MedianBlurBool) self.MedianBlurCheck.configure(takefocus="") self.MedianBlurCheck.configure(text='''Median Blur''') self.MedianBlurCheck.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.LineApproxCheck = ttk.Checkbutton(master) self.LineApproxCheck.place(relx=0.52, rely=0.46, relwidth=0.12 , relheight=0.0, height=21) self.LineApproxCheck.configure(variable=UI_Mobot_Configuration_support.LineApproxBool) self.LineApproxCheck.configure(takefocus="") self.LineApproxCheck.configure(text='''Line Approx.''') self.LineApproxCheck.bind('<ButtonRelease-1>',lambda e:UI_Mobot_Configuration_support.settingsChanged(e)) self.PreviewButton = ttk.Button(master) self.PreviewButton.place(relx=0.52, rely=0.55, height=25, width=76) self.PreviewButton.configure(command=UI_Mobot_Configuration_support.previewAction) self.PreviewButton.configure(takefocus="") self.PreviewButton.configure(text='''Preview''') self.ProcessedImageLabel = Label(master) self.ProcessedImageLabel.place(relx=0.35, rely=0.7, height=161 , width=214) self.ProcessedImageLabel.configure(activebackground="#f9f9f9") self.ProcessedImageLabel.configure(activeforeground="black") self.ProcessedImageLabel.configure(background="#a0a0a0") self.ProcessedImageLabel.configure(disabledforeground="#a3a3a3") self.ProcessedImageLabel.configure(foreground="#000000") self.ProcessedImageLabel.configure(highlightbackground="#d9d9d9") self.ProcessedImageLabel.configure(highlightcolor="black") self.ProcessedImageLabel.configure(text='''No Signal''') self.OriginalImageLabel = Label(master) self.OriginalImageLabel.place(relx=0.03, rely=0.7, height=161, width=214) self.OriginalImageLabel.configure(activebackground="#f9f9f9") self.OriginalImageLabel.configure(activeforeground="black") self.OriginalImageLabel.configure(background="#a0a0a0") self.OriginalImageLabel.configure(disabledforeground="#a3a3a3") self.OriginalImageLabel.configure(foreground="#000000") self.OriginalImageLabel.configure(highlightbackground="#d9d9d9") self.OriginalImageLabel.configure(highlightcolor="black") self.OriginalImageLabel.configure(text='''No Signal''') self.Label16 = Label(master) self.Label16.place(relx=0.03, rely=0.65, height=21, width=84) self.Label16.configure(activebackground="#f9f9f9") self.Label16.configure(activeforeground="black") self.Label16.configure(background=_bgcolor) self.Label16.configure(disabledforeground="#a3a3a3") self.Label16.configure(foreground="#000000") self.Label16.configure(highlightbackground="#d9d9d9") self.Label16.configure(highlightcolor="black") self.Label16.configure(text='''Original Image''') self.Label17 = Label(master) self.Label17.place(relx=0.35, rely=0.65, height=21, width=95) self.Label17.configure(activebackground="#f9f9f9") self.Label17.configure(activeforeground="black") self.Label17.configure(background=_bgcolor) self.Label17.configure(disabledforeground="#a3a3a3") self.Label17.configure(foreground="#000000") self.Label17.configure(highlightbackground="#d9d9d9") self.Label17.configure(highlightcolor="black") self.Label17.configure(text='''Processed Image''') self.Label18 = Label(master) self.Label18.place(relx=0.68, rely=0.65, height=21, width=95) self.Label18.configure(activebackground="#f9f9f9") self.Label18.configure(activeforeground="black") self.Label18.configure(background=_bgcolor) self.Label18.configure(disabledforeground="#a3a3a3") self.Label18.configure(foreground="#000000") self.Label18.configure(highlightbackground="#d9d9d9") self.Label18.configure(highlightcolor="black") self.Label18.configure(text='''Computer Vision''') self.CVImageLabel = Label(master) self.CVImageLabel.place(relx=0.68, rely=0.7, height=161, width=214) self.CVImageLabel.configure(activebackground="#f9f9f9") self.CVImageLabel.configure(activeforeground="black") self.CVImageLabel.configure(background="#a0a0a0") self.CVImageLabel.configure(disabledforeground="#a3a3a3") self.CVImageLabel.configure(foreground="#000000") self.CVImageLabel.configure(highlightbackground="#d9d9d9") self.CVImageLabel.configure(highlightcolor="black") self.CVImageLabel.configure(text='''No Signal''') self.StopButton = ttk.Button(master) self.StopButton.place(relx=0.72, rely=0.38, height=115, width=126) self.StopButton.configure(command=UI_Mobot_Configuration_support.emergencyStopAction) self.StopButton.configure(takefocus="") self.StopButton.configure(text='''Emergency Stop''')