def initUI(self, parent): self.style = Style() self.style.theme_use("classic") Style().configure("TLabel", font='serif 10', weight="Bold") # creating layout from frames self.frame1 = Frame(parent) self.frame1.pack(fill="both", expand="True") self.frame2 = Frame(parent) self.frame2.pack(fill="both", expand="True") # putting text in frame1 Label(self.frame1, text="Completed!! \n Do you want to EXIT?", font="Helvetica 10 bold").pack(side="bottom", anchor='center') # putting button in frame2 self.b10 = Button(self.frame2, text="Yes", width=7, state="active", font='serif 10', command=self.yes_clicked) self.b11 = Button(self.frame2, text="No", width=7, state="active", font='serif 10', command=self.no_clicked) self.b10.pack(side="left", padx=8) self.b11.pack(side="left", padx=8) self.b10.bind('<Return>', self.yes_clicked) self.b11.bind('<Return>', self.no_clicked)
def initUI(self): var = IntVar() #General stuff self.parent.title("I2C Command Manager") self.style = Style() self.style.theme_use("default") #self.pack(fill=BOTH, expand=1) self.parent.configure(background=Constants.BG_COL) s = Style() s.configure('C.TRadiobutton', background=Constants.BG_COL) #Quit button quitButton = Button(self.parent, text="Quit", command=self.quit) quitButton.place(x=Constants.QUIT_X, y=Constants.QUIT_Y) #Radiobuttons ledRadio = Radiobutton( self.parent, text="LED Strip", variable=var, value=1, command=lambda: self.instructor.setAddress(0x04), style='C.TRadiobutton') vertRadio = Radiobutton( self.parent, text="Vertical Motion", variable=var, value=2, command=lambda: self.instructor.setAddress(0x06), style='C.TRadiobutton') ledRadio.place(x=Constants.LED_X, y=Constants.LED_Y) vertRadio.place(x=Constants.VERT_X, y=Constants.VERT_Y) #ledRadio.configure(background = Constants.BG_COL) #Label sendLabel = Label(self.parent, text="Enter command:", background=Constants.BG_COL) sendLabel.place(x=Constants.SENDL_X, y=Constants.SENDL_Y) #Address label adLabel = Label(self.parent, text="Select address:", background=Constants.BG_COL) adLabel.place(x=Constants.ADL_X, y=Constants.ADL_Y) #Text entry box textBox = Entry(self.parent, bd=2, width=Constants.TEXT_W) textBox.place(x=Constants.TEXT_X, y=Constants.TEXT_Y) #Send command button sendButton = Button(self.parent, text="Send", command=lambda: self.assignCommand(textBox.get())) sendButton.place(x=Constants.SENDB_X, y=Constants.SENDB_Y)
def initUI(self, parent): self.style = Style() self.style.theme_use("classic") Style().configure("TLabel", font='serif 10', weight="Bold") # creating layout from frames self.frame0 = Frame(parent) self.frame0.pack(fill="both", expand="True") self.frame1 = Frame(parent) self.frame1.pack(fill="both", expand="True") self.frame2 = Frame(parent) self.frame2.pack(fill="both", expand="True") self.frame3 = Frame(parent) self.frame3.pack(fill="both", expand="True") self.frame4 = Frame(parent) self.frame4.pack(fill="both", expand="True") self.frame5 = Frame(parent) self.frame5.pack(fill="both", expand="True") # putting text in frame1 msg1 = "File or Directory not found:" msg2 = "1. It has been deleted" msg3 = "2. Was never created" msg4 = "3. Someone has modified file 'last_address.txt'" msg5 = "Please re-enter address" Label(self.frame0, text=msg1, font="Helvetica 11 bold", anchor='center').pack(side="top") Label(self.frame1, text=msg2, font="Helvetica 10 ", anchor='nw').pack(side="left", padx=5) Label(self.frame2, text=msg3, font="Helvetica 10 ", anchor='nw').pack(side="left", padx=5) Label(self.frame3, text=msg4, font="Helvetica 10 ", anchor='nw').pack(side="left", padx=5) Label(self.frame4, text=msg5, font="Helvetica 11 bold", anchor='center').pack(side="top") # putting button in frame2 self.b12 = Button(self.frame5, text="Ok", width=7, state="active", font='serif 10', command=self.clicked) self.b12.pack() self.b12.bind('<Return>', self.clicked)
def showHelpCallback(self): print "ShowHelpCallback " self.t = Toplevel(self) self.t.wm_title("Help") self.t.style = Style() self.t.style.theme_use("default") #t.pack(fill=BOTH, expand=1) self.t.columnconfigure(1, weight=1) self.t.columnconfigure(3, pad=7) self.t.rowconfigure(5, weight=1) self.t.rowconfigure(7, pad=7) r = 0 area = Text(self.t, height=20, width=50) scroll = Scrollbar(self.t, command=area.yview) area.configure(yscrollcommand=scroll.set) area.tag_configure('bold_italics', font=('Arial', 12, 'bold', 'italic')) area.tag_configure('big', font=('Verdana', 20, 'bold')) area.tag_configure('color', foreground='#476042', font=('Tempus Sans ITC', 12, 'bold')) area.grid(row=r, column=0, columnspan=2, rowspan=2, padx=3, sticky=E + W + N) area.insert(END, "Py Shark Help\n\n", 'big') area.insert(END, "Just a text Widget\nin two lines\n") area.config(state=DISABLED)
def initUI(self): #some aesthetic definitions self.parent.title("Message Responder") self.style = Style() self.style.theme_use("classic") #building frame frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=True) self.pack(fill=BOTH, expand=True) #adding some widgets label = Label(frame, text=self.text, wraplength=495, justify=LEFT) label.pack() self.textBox = Text(frame, height=2, width=495) self.textBox.pack(side=BOTTOM) #self.textBox.insert(END, '#enter ye comments here') labelBox = Label(frame, text="Actual Results:") labelBox.pack(anchor=W, side=BOTTOM) passButton = Button(self, text="PASS", command=self.btnClickedPass) passButton.pack(side=RIGHT, padx=5, pady=5) failButton = Button(self, text="FAIL", command=self.btnClickedFail) failButton.pack(side=RIGHT)
def initUI(self): self.style = Style().configure("TFrame", background=self.sys.win_cfg.cBackground) self.pack(fill=BOTH, expand=1) # setup labels self.Embedded = Label(self, width=15, background=self.sys.win_cfg.cUnknown, text="LED: COM0") self.Embedded.place(x=15, y=35) self.Stage = Label(self, width=15, background=self.sys.win_cfg.cUnknown, text="Stages: COM0") self.Stage.place(x=15, y=60) # setup buttons configComButton = Button(self, text="COM Port Setup", command=self.com_port_search, width=17) configComButton.place(x=15, y=5) # close buttons closeButton = Button(self, text="Close", command=self.close_window, width=17) closeButton.place(x=15, y=90)
def initUI(self): self.parent.title("Paste IP's Here:") self.style = Style() self.style.theme_use("aqua") self.pack(fill=BOTH, expand=1) self.columnconfigure(1, weight=1) self.columnconfigure(3, pad=7) self.rowconfigure(3, weight=1) self.rowconfigure(5, pad=7) lbl = Label(self, text="Paste IP's Here:") lbl.grid(sticky=W, pady=4, padx=5) area = Text(self) area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E + W + S + N) abtn = Button(self, text="Open", command=self.onOpen()) abtn.grid(row=1, column=3) cbtn = Button(self, text="Close") cbtn.grid(row=2, column=3, pady=4) hbtn = Button(self, text="Help") hbtn.grid(row=5, column=0, padx=5) obtn = Button(self, text="OK") obtn.grid(row=5, column=3)
def initUI(self): photo = ImageTk.PhotoImage(file='icon/main_bg_4.jpg') w = Tkinter.Label(self,image=photo) w.photo = photo w.place(x=0, y=0, relwidth=1, relheight=1) #ackground_label.pack() self.api = IntVar() self.parent.title("Face Recognition System") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) faceplus = Radiobutton(self, text="Face++", variable=self.api, value=1) faceplus.place(x=50, y=40) facer = Radiobutton(self, text="FaceR Animetrics", variable=self.api, value=2) facer.place(x=200, y=40) start = Button(self, text="Start Recognition", command=self.startRecognition) start.place(x=100, y=80) helpButton = Button(self, text="Help", command=self.giveHelp) helpButton.place(x=100, y=110) quitButton = Button(self, text="Quit", command=self.quitGUI) quitButton.place(x=100, y=140)
def initUI(self): self.parent.title("MyStock") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=True) menubar = Menu(self.parent) self.parent.config(menu=menubar) fileMenu = Menu(menubar) fileMenu.add_command(label="Exit", command=self.onExit) menubar.add_cascade(label="File", menu=fileMenu) submenu= Menu(fileMenu) submenu.add_command(label="New feed") submenu.add_command(label="Bookmarks") submenu.add_command(label="Mail") fileMenu.add_cascade(label='Import', menu=submenu, underline=0) fileMenu.add_separator() closeButton = Button(self, text="Close", command=self.quit) closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self, text="OK") okButton.pack(side=RIGHT) self.pack(fill=BOTH, expand=1) self.centerWindow()
def __initUi(self): self.master.title('Shine Production') self.pack(fill=BOTH, expand=1) Style().configure("TFrame", background="#333") #Status of Test frame self.status_frame = LabelFrame(self, text='Status', relief=RIDGE, width=800, height=500) self.status_frame.place(x=20, y=20) #QR SERIAL # Frame self.path_frame = LabelFrame(self, text='QR Serial Code', relief=RIDGE, height=60, width=235) self.path_frame.place(x=400, y=550) entry = Entry(self.path_frame, bd=5, textvariable=self.serial_num_internal) entry.place(x=50, y=5) #TEST RESULTS LABEL w = Label(self.status_frame, textvariable=self.results) w.place(x=50, y=50) #START Button self.start_button = Button(self, text="Start", command=self.start, height=4, width=20) self.start_button.place(x=100, y=550) # Initialize the DUT initDUT()
def initUI(self): self.parent.title("Buttons") self.style = Style() self.style.theme_use("alt") # Styling self.style.configure('.', font=('Helvetica', 12), background="#300A24") self.style.configure( "PW.TLabel", foreground="#fff", background="#300A24", padding=20, justify=CENTER, wraplength="350") self.style.configure( "Medium.TButton", foreground="#300A24", background="#fff", borderwidth=0, padding=8, font=('Helvetica', 9)) # Styling Ends quoteLabel = Label(self, text=self.quote, style="PW.TLabel") quoteLabel.pack() authorLabel = Label(self, text=self.author, style="PW.TLabel") authorLabel.pack() self.pack(fill=BOTH, expand=True) closeButton = Button(self, text="Close This", style="Medium.TButton", command=self.parent.quit) closeButton.pack(side=RIGHT) okButton = Button( self, text="Portfolio", style="Medium.TButton", command=self.btnOneFn) okButton.pack(side=RIGHT) okButton = Button(self, text="JStack", style="Medium.TButton", command=self.btnTwoFn) okButton.pack(side=RIGHT) okButton = Button(self, text="Python", style="Medium.TButton", command=self.btnThreeFn) okButton.pack(side=RIGHT)
def initUI(self): self.parent.title("Windows") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.columnconfigure(1, weight=1) self.columnconfigure(3, pad=7) self.rowconfigure(3, weight=1) self.rowconfigure(5, pad=7) lbl = Label(self, text="Windows") lbl.grid(sticky=W, pady=4, padx=5) area = Text(self) area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E + W + S + N) abtn = Button(self, text="Activate") abtn.grid(row=1, column=3) cbtn = Button(self, text="Close") cbtn.grid(row=2, column=3, pady=4) hbtn = Button(self, text="Help") hbtn.grid(row=5, column=0, padx=5) obtn = Button(self, text="OK") obtn.grid(row=5, column=3)
def initUI(self): self.parent.title("Story Creator") self.grid(row=0, column=0) Style().configure("TButton", padding=(0, 5, 0, 5), background='black') #logo = ImageTk.PhotoImage(Image.open(json_reader.buildPath("creator_logo.png"))) #logolabel = Label(self, image=logo, bg='black') #logolabel.image = logo #logolabel.grid(row=0, column=0) intframe = Frame(self) intframe.configure(bg='black') intframe.grid(row=0, column=1) createSL = Button(intframe, text="Create Social Link", command=self.actionS) createSL.grid(row=0, column=0) createPersona = Button(intframe, text="Create Persona", command=self.actionP) createPersona.grid(row=1, column=0) createChar = Button(intframe, text="Create Character", command=self.actionC) createChar.grid(row=2, column=0) quit = Button(intframe, text="Quit", command=self.quit) quit.grid(row=3, column=0)
def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.parent.title("Twitter Judge") self.style = Style() self.style.theme_use("default") output_frame = Frame(self, relief = RIDGE, borderwidth = 1) output_frame.pack(anchor = N, fill = BOTH, expand = True) output_text = ScrolledText(output_frame) self.output_text = output_text output_text.pack(fill = BOTH, expand = True) input_frame = Frame(self, height = 32) input_frame.pack(anchor = S, fill = X, expand = False) user_label = Label(input_frame, text = "Enter username:"******"Judge!", command = lambda: judge(user_entry.get(), self)) judge_button.pack(side = RIGHT) user_entry = Entry(input_frame) user_entry.pack(fill = X, padx = 5, pady = 5, expand = True) self.pack(fill = BOTH, expand = True)
def initUI(self): self.parent.title("Example") self.pack(fill=BOTH, expand=1) self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=Tkinter.RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) okButton = Button(self, text="OK") okButton.place(x=self.width - 200, y=self.height - 100) quitButton = Button(self.parent, text="QUIT") quitButton.place(x=self.width - 100, y=self.height - 100) scale = 0.75 self.wow_pic = Image.open("hd_1.jpg") self.wow_pic = self.wow_pic.resize( (int(self.width * scale), int(self.height * scale))) self.wow_pic_tk = ImageTk.PhotoImage(self.wow_pic) self.label_wow_pic = Label(self, image=self.wow_pic_tk) self.label_wow_pic.image = self.wow_pic_tk self.label_wow_pic.place(x=10, y=10) info_x = int(self.width * scale) + 20 label_text_area = Tkinter.Label(self, text="Message received:") label_text_area.place(x=info_x, y=10) self.text_area = Tkinter.Text(self, height=10, width=40) self.text_area.place(x=info_x, y=30)
def initUI(self): self.style = Style().configure("TFrame", background=self.sys.win_cfg.cBackground) self.pack(fill=BOTH, expand=1) titleLabel = Label(self, text=self.sys.win_cfg.sFileinfo, background=self.sys.win_cfg.cBackground, width=12, height=1) titleLabel.place(x=5, y=5) # file function buttons browseButton = Button(self, text="Browse", command=self.browse_folder, width=12) browseButton.place(x=15, y=40) netButton = Button(self, text="Net", command=self.net_check, width=8) netButton.place(x=125, y=40) chipIDLabel = Label(self, text="Chip ID: ", background=self.sys.win_cfg.cBackground, width=8, height=1) chipIDLabel.place(x=10, y=80) self.chipIDEntry = Entry(self, width=15, background=self.sys.win_cfg.cTextBackground) self.chipIDEntry.place(x=85, y=80) self.chipIDEntry.insert(0, self.instant_chip_id()) # close buttons closeButton = Button(self, text="Close", command=self.close_window, width=17) closeButton.place(x=15, y=140)
def __initUi(self): self.master_batt.title('Battery Plot') self.pack(fill=BOTH, expand=1) style = Style().configure("TFrame", background="#333") battPlot = ImageTk.PhotoImage(file="view/images/batteryPlot.png") label1 = Label(self, image=battPlot) label1.image = battPlot label1.place(x=0, y=0, width=1500, height=900) # Pass and Fail Buttons self.fail_button = Button(self, text="Fail", command=self.failed, height=4, width=20, background='red') self.fail_button.place(x=1080, y=850, width=100, height=30) self.pass_button = Button(self, text="Pass", command=self.passed, height=4, width=20, background='green') self.pass_button.place(x=1240, y=850, width=100, height=30)
def display_ClassConfigs(name,self,controller): i=1;j=2; # Column and row incrementers sty = Style(self); sty.configure("TSeparator", background="black"); if name == "DetailsPage": inputdata = load_configdata(); set_configunits(); # Load data, store units for key in Application.key_order: if i>7: i = 1; j = j+1; # Column limit exceeded, begin new row labelName = tk.Label(self,font = NORMAL_FONT,text=key + ":"); labelName.grid(column=i, row=j); fieldName = tk.Entry(self); fieldName.grid(column=i+2, row=j, rowspan=1); fieldName.insert(1,inputdata[key]); fieldName.configure(state="readonly"); if Application.units_set[key] != "None": unitsLabel = tk.Label(self,font = NORMAL_FONT,text="("+Application.units_set[key]+")"); unitsLabel.grid(column=i+4, row=j); sep = Separator(self, orient="vertical") sep.grid(column=6, row=j-1, rowspan=2, sticky="nsew") Application.DetailsPage_entries.append(fieldName); Application.DetailsPage_labels.append(labelName); # Store widgets i = i+6 # Column for Second label/entry pair backbutton = tk.Button(self, bd = "2", fg = "white", bg = "blue", font = NORMAL_FONT, text="Back",command=lambda: controller.show_frame(SettingsPage)).grid(row=int(math.ceil(len(Application.key_order)/2))+2,column=13,rowspan=1) editbutton = tk.Button(self, bd = "2", fg = "white", bg = "gray", font = NORMAL_FONT, text="Edit",command=lambda: controller.show_frame(EditConfigsPage)).grid(row=int(math.ceil(len(Application.key_order)/2))+2,column=12,rowspan=1) else: for key in Application.key_order: if i>7: i = 1; j = j+1; # Column limit exceeded, begin new row labelName = tk.Label(self,font = NORMAL_FONT,text=key + ":"); labelName.grid(column=i, row=j); fieldName = tk.Entry(self); fieldName.grid(column=i+2, row=j); fieldName.insert(5,Application.configData[key]); # Create entry, add data if Application.units_set[key] != "None": unitsLabel = tk.Label(self,font = NORMAL_FONT,text="("+Application.units_set[key]+")"); unitsLabel.grid(column=i+4, row=j); sep = Separator(self, orient="vertical") sep.grid(column=6, row=j-1, rowspan=2, sticky="nsew") Application.EditPage_entries.append(fieldName); Application.EditPage_labels.append(labelName); # Store widgets i = i+6 # Column for Second label/entry pair Application.firstEdit = False # Config settings have been edited pad_children(self) # Assign padding to child widgets
def initUI(self): self.parent.title("Example") self.pack(fill=BOTH, expand=1) self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=Tkinter.RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) #okButton = Button(self, text = "OK") #okButton.place(x = self.width - 200, y = self.height - 100) #quitButton = Button(self.parent, text = "QUIT", command = self.endCommand) #quitButton.place(x = self.width - 100, y = self.height - 100) scale = 0.75 self.wow_pic = Image.open("hd_1.jpg") self.wow_pic = self.wow_pic.resize((self.width, self.height)) self.wow_pic_tk = ImageTk.PhotoImage(self.wow_pic) self.label_wow_pic = Label(self, image=self.wow_pic_tk) self.label_wow_pic.image = self.wow_pic_tk self.label_wow_pic.place(x=0, y=0) info_x = int(self.width * scale) + 20
def initUI(self): self.parent.title("File dialog") menubar = Menu(self.parent) self.parent.config(menu=menubar) fileMenu = Menu(menubar) fileMenu.add_command(label="Open", command=self.onOpen) menubar.add_cascade(label="File", menu=fileMenu) self.style = Style() self.style.theme_use("default") global frame1 frame1 = Frame() frame1.grid(row=0, column=0, sticky='w') l1 = Label(frame1, text='CSV file name', relief=RIDGE, width=20) l1.grid(row=4, column=0) l2 = Label(frame1, text='SCR file name', relief=RIDGE, width=20) l2.grid(row=5, column=0) inform = Button(frame1, text="Choose CSV file", command=self.onCSVfile) inform.grid(row=1, column=0) self.file_opt = options = {} options['defaultextension'] = '.csv' options['filetypes'] = [('CSV files', '.csv'), ('all files', '.*')]
def __init__(self, parent, controller): Frame.__init__(self, parent) self.controller = controller self.parent = parent Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=10) self.columnconfigure(1, pad=10) self.rowconfigure(0, pad=10) self.rowconfigure(1, pad=10) self.rowconfigure(2, pad=10) self.btn_wifi = Button(self, text="Wifi Connection Demo", command=lambda: controller.show_frame("Test_Wifi"), width=BTN_WIDTH) self.btn_wifi.grid(row=1, column=0) self.btn_gps_3g = Button(self, text="3G + GPS Demo", command=lambda: controller.show_frame("Test_GPS3G"), width=BTN_WIDTH) self.btn_gps_3g.grid(row=1, column=1) self.btn_cepas = Button(self, text="Cepas Reader Demo", command=lambda: controller.show_frame("Test_Cepas"), width=BTN_WIDTH) self.btn_cepas.grid(row=2, column=0) self.btn_zebra_scanner = Button(self, text="Zebra Scanner Demo", command=lambda: controller.show_frame("Test_ZebraScanner"), width=BTN_WIDTH) self.btn_zebra_scanner.grid(row=2, column=1) self.pack()
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) style = Style() style.configure("TFrame", background="#333")
def initUI(self): self.parent.title("WORLD") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) #pack = a geometry manager #button b = Button(self, text=" GO ", command=self.callback) b.pack(side=TOP, padx=15, pady=20) #text t = Text(self, height=3, width=40) t.pack(side=TOP, padx=15) t.insert( END, "Welcome.\nPlease select the number of years\nyou would like to run the Simulation.\n" ) #slider slider = Scale(self, from_=0, to=400, command=self.onScale) #values of slider! slider.pack(side=TOP, padx=15) self.var = IntVar() self.label = Label(self, text=0, textvariable=self.var) self.label.pack(side=TOP, padx=15)
def initUI(self): self.parent.title(self.title) self.style = Style() #Choose from default, clam, alt, classic self.style.theme_use('alt') self.pack(fill=tk.BOTH, expand=True) self.centerWindow()
def __init__(self, window): self.window = window self.mainDaemonAlive = False self.reportServerAlive = False self.reportServerBut = None self.progressbarRunning = False self.modelTree = None self.nsListStr = StringVar(self.window) self.filterStatusStr = StringVar(self.window) self.reportClientStatusStr = StringVar(self.window) self.playModeStr = StringVar(self.window, PLAY_MODES[0]) self.pktCopyMaxSize = StringVar(self.window, "60") self.netInterfaceStr = StringVar(self.window, NET_INTERFACES[0]) self.servicePortsStr = StringVar(self.window, "DNS") self.debugLevelStr = StringVar(self.window, DEBUG_LEVELS[0]) self.filterControlButStr = StringVar(self.window, "START") self.reportClientControlButStr = StringVar(self.window, "START") self.progressFrame = Frame(self.window, width=700, height=20) self.progressFrame.pack(side=TOP) Frame(self.window, width=700, height=10).pack(side=TOP) self.parseNS("/etc/resolv.conf") self.getDaemonStatus() self.home() Frame(self.window, width=700, height=10).pack(side=TOP) self.window.resizable(width=False, height=False) Style().configure("TButton", padding=6, relief="raised", background="#999")
def remove_tab_controls(self): """Remove tab area and most tab bindings from this window.""" if TTK: self.text_notebook['style'] = 'PyShell.TNotebook' style = Style(self.top) style.layout('PyShell.TNotebook.Tab', [('null', '')]) else: self.text_notebook._tab_set.grid_forget() # remove commands related to tab if 'file' in self.menudict: menu = self.menudict['file'] curr_entry = None i = 0 while True: last_entry, curr_entry = curr_entry, menu.entryconfigure(i) if last_entry == curr_entry: # no more menu entries break if 'label' in curr_entry and 'Tab' in curr_entry['label'][-1]: if 'Close' not in ' '.join(curr_entry['label'][-1]): menu.delete(i) i += 1 self.current_page.text.unbind('<<new-tab>>')
def initUI(self): global init self.parent.title("Mavric Hip GUI") self.style = Style() self.style.theme_use("default") self.pack() #Initialize figure fig = matplotlib.figure.Figure() ax = fig.add_subplot(111) self.thisImg = np.eye(512, 512) self.figDrawing = ax.imshow(self.thisImg, cmap='gray') self.canvas=FigureCanvasTkAgg(fig,master=self) self.canvas.show() self.canvas.get_tk_widget().configure(takefocus=True) self.canvas.get_tk_widget().grid(row=0, column=1, columnspan=2, rowspan=1) #Reset the focus to the dicom images self.canvas.mpl_connect('button_press_event', lambda event:self.canvas._tkcanvas.focus_set()) #Watch for mouse or key press events self.canvas.mpl_connect('button_press_event',self.selectRoi) self.canvas.mpl_connect('button_press_event', lambda event: PopUp()) self.canvas.mpl_connect('key_press_event',self.writeRoi) #Load the buttons nextButton = Button(self, text="<", command=self.prev) nextButton.grid(row=0, column=0) openButton = Button(self, text="Open", command=self.pickFile) openButton.grid(row=2, column=1, sticky=E) quitButton = Button(self, text="Quit", command=self.quit) quitButton.grid(row=2, column=2, sticky=W) nextButton = Button(self, text=">", command=self.next) nextButton.grid(row=0, column=3)
def initUI(self): self.parent.title("AUTO TIPS") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.columnconfigure(1, weight=1) self.columnconfigure(3, pad=7) self.rowconfigure(3, weight=1) self.rowconfigure(5, pad=7) lbl = Label(self, text="Status") lbl.grid(sticky=W, pady=4, padx=5) area = Text(self) area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E + W + S + N) abtn = Button(self, text="Drive Command", command=win3) abtn.grid(row=1, column=3) cbtn = Button(self, text="Tester Manual Control", command=win2) cbtn.grid(row=2, column=3, pady=4) dbtn = Button(self, text="Auto Run", command=AutoTIPS) dbtn.grid(row=3, column=3, pady=4) obtn = Button(self, text="OK", command=self.parent.destroy) obtn.grid(row=5, column=3)
def initUI(self): self.parent.title("Image Copy-Move Detection") self.style = Style().configure("TFrame", background="#333") # self.style.theme_use("default") self.pack(fill=BOTH, expand=1) quitButton = Button(self, text="Open File", command=self.onFilePicker) quitButton.place(x=10, y=10) printButton = Button(self, text="Detect", command=self.onDetect) printButton.place(x=10, y=40) self.textBoxFile = Text(self, state='disabled', width=80, height = 1) self.textBoxFile.place(x=90, y=10) self.textBoxLog = Text(self, state='disabled', width=40, height=3) self.textBoxLog.place(x=90, y=40) # absolute image widget imageLeft = Image.open("resource/empty.png") imageLeftLabel = ImageTk.PhotoImage(imageLeft) self.labelLeft = Label(self, image=imageLeftLabel) self.labelLeft.image = imageLeftLabel self.labelLeft.place(x=5, y=100) imageRight = Image.open("resource/empty.png") imageRightLabel = ImageTk.PhotoImage(imageRight) self.labelRight = Label(self, image=imageRightLabel) self.labelRight.image = imageRightLabel self.labelRight.place(x=525, y=100) self.centerWindow()
def initUI(self): self.parent.title("simple") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=3) self.columnconfigure(3, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(4, pad=3) entry = Entry(self) entry.grid(row=0, columnspan=4, sticky=W + E) cls = Button(self, text="Cls") cls.grid(row=1, column=0) quitbutton = Button(self, text="quit", command=self.parent.destroy) quitbutton.grid(row=4, column=0) self.var = IntVar() cb = Checkbutton(self, text="show title", variable=self.var, command=self.onClick) cb.select() cb.grid(row=2, column=2) self.pack()