def initUI(self): self.parent.title("Buttons") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=GROOVE, borderwidth=5) frame.pack(fill=BOTH, expand=1) self.pack(fill = BOTH, expand = 1) self.imageLabel = Label(frame, image = "") self.imageLabel.pack(fill=BOTH, expand=1) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT) okButton = Button(self, text="OK") okButton.pack(side=RIGHT) options = [item for item in dir(cv2.cv) if item.startswith("CV_CAP_PROP")] option = OptionMenu(self, self.key, *options) self.key.set(options[0]) option.pack(side="left") spin = Spinbox(self, from_=0, to=1, increment=0.05) self.val = spin.get() spin.pack(side="left")
def initUI(self): w = Label(self, text="The Predicted Star Value") w.pack() global star_score image = Image.open("stars_0.jpg") star = star_score if (star == 1): image = Image.open("stars_1.jpg") if (star == 2): image = Image.open("stars_2.jpg") if (star == 3): image = Image.open("stars_3.jpg") if (star == 4): image = Image.open("stars_4.jpg") if (star == 5): image = Image.open("stars_5.jpg") photo = ImageTk.PhotoImage(image) label = Label(self,image=photo) label.image = photo label.pack() T = Text(self, height=20, width=100) T.pack() Textbox = submitted_text T.insert(END, Textbox) b1 = Button(self, text="Write another review", command=self.toreview) b2 = Button(self, text="Change Restaurant", command=self.tolist) b1.pack() b2.pack() self.pack(fill=BOTH, expand=1)
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()
class MyButton: #Класс для улучшения читаемости кода однотипных элементов кнопок. def __init__(self, place_class, string_class, command_class): #При создании принимается место прикрепления виджета, строковое значение для надписи #и строковое для установления команды при нажатии. self.button_class = Button(place_class, width = 30, text = string_class, command = command_class) self.button_class.pack(side = LEFT)
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): #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): #<standard set up> self.parent.title("Buttons") self.style = Style() self.style.theme_use("default") #</standard set up> #if you put buttons here, it will initiate the buttons. #then it will initiate the frame. You would get two columns. #buttons appear in the second "lowered" area and not the raised frame. #<adding an additional frame> frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand =1) #</adding an additional frame> #<standard self.pack> self.pack(fill=BOTH, expand =1) #</standard self.pack> #<buttons are placed here> closeButton = Button (self, text = "Close") closeButton.pack(side=RIGHT, padx=5, pady =5) okButton = Button(self, text = "OK") okButton.pack(side=RIGHT)
def showLoading(self): self.attemptedMarkov = True popup = Toplevel() text = Message(popup, text="The Markov Generator is still loading!\n\nText will show up when loaded!") text.pack() closePop = Button(popup, text="Okay!", command=popup.destroy) closePop.pack()
def initUI(self): self.parent.title("Simple") self.style = Style() self.style.theme_use("default") self.textup = Text(self, width=340, height=34) self.textup.bind("<KeyPress>", lambda e: "break") self.textup.pack() self.frame = Frame(self, relief=RAISED, borderwidth=1) self.frame.pack(fill=BOTH, expand=1) self.pack(fill=BOTH, expand=1) Label(self.frame,text = '', width= "350", height="1").pack() Label(self.frame,text = '欢迎大家', width= "350", height="1").pack() Label(self.frame,text = '', width= "350", height="3").pack() self.text = Text(self, width=340, height=3) self.text.bind("<Return>", self.sendMes) self.text.pack() closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self, text="OK", command=self.onClick) okButton.pack(side=RIGHT)
def initUI(self): self.parent.title("Book downloader") self.style = Style() self.style.theme_use("default") framesearch = Frame(self) framesearch.pack(fill=BOTH) search_label = Label(framesearch, text="Filter books:", padx=5, pady=5, width=15) search_label.pack(side=LEFT) self.search_entry = Entry(framesearch) self.search_entry.pack(side=RIGHT, fill=X) self.search_entry.bind("<Return>", self.searchHandler) #self.search_entry.bind("<Key>", self.searchHandler) framelist = Frame(self, relief=RAISED, borderwidth=1) framelist.pack(fill=BOTH, expand=True) self.lb = Listbox(framelist, height=30) scrollbar = Scrollbar(framelist) scrollbar.pack(side=RIGHT, fill=Y) self.lb.config(yscrollcommand=scrollbar.set) scrollbar.config(command=self.lb.yview) self.loadLibrary() for b in self.book_list: self.lb.insert(END, b[0]) self.lb.pack(fill=BOTH) self.pack(fill=BOTH, expand=True) DownButton = Button(self, text="Download", command=self.downloadAction) DownButton.pack(side=RIGHT)
def initUI(self): self.parent.title("Buttons") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) #We create another Frame widget. #This widget takes the bulk of the area. #We change the border of the frame so that the frame is visible. #By default it is flat. self.pack(fill=BOTH, expand=1) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) #A closeButton is created. #It is put into a horizontal box. #The side parameter will create a horizontal box layout, in which the button is placed to the right of the box. #The padx and the pady parameters will put some space between the widgets. #The padx puts some space between the button widgets and between the closeButton and the right border of the root window. #The pady puts some space between the button widgets and the borders of the frame and the root window. okButton = Button(self, text="OK") okButton.pack(side=RIGHT)
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 showHighscores(): # get top 5 scores arr = session.query(Highscores).all() for i in range(len(arr)): for j in range(i, len(arr)): if (arr[i].score > arr[j].score): arr[i], arr[j] = arr[j], arr[i] top = Toplevel() top.title('Highscores') msg = Message(top, text='Top 5 Leaderboard:') msg.pack count = 1 for i in range(5): text = str(count) text += '. ' text += str(arr[i].name) text += ': ' text += str(arr[i].score) label = Label(top, text=text) label.pack() count += 1 button = Button(top, text='Dismiss', command=top.destroy) button.pack() top.geometry('%dx%d+%d+%d' % (200, 200, 600, 300))
def __init__(self, parent, controller): Frame.__init__(self, parent) self.controller = controller label = Label(self, text="About", font=TITLE_FONT, justify=CENTER, anchor=CENTER) label.pack(side="top", fill="x", pady=10) label_2 = Label(self, text= """ Frogs vs Flies is a cool on-line multi-player game. It consists of hungry frogs, trying to catch some darn tasty flies to eat and not starve to death, and terrified, but playful flies that try to live as long as possible to score points by not being eaten by nasty frogs. ---------------------------------------------------------------------------------------- When the game has been selected or created, and your class selected, click in the game field to start feeling your limbs. To move, use your keyboard's arrows. By this point, you should know where they are located, don't you? Great! Now you can start playing the game! ---------------------------------------------------------------------------------------- Frogs, being cocky little things, have the ability to do a double jump, holding SHIFT while moving with cursors. And flies, being so fly, that the air can't catch up with them, have a greater field of view, so they can see frogs before they can see them. ---------------------------------------------------------------------------------------- Have a wonderful time playing this awesome game! ---------------------------------------------------------------------------------------- Created by Kristaps Dreija and Egils Avots in 2015 Fall """, font=ABOUT_FONT, anchor=CENTER, justify=CENTER) label_2.pack() button1 = Button(self, text="\nBack\n", command=lambda: controller.show_frame("StartPage")) button1.pack(ipadx=20,pady=10)
def __init__(self, parent, controller): Frame.__init__(self, parent) self.selected = ""; self.controller = controller label = Label(self, text="Select server", font=TITLE_FONT, justify=CENTER, anchor=CENTER) label.pack(side="top", fill="x", pady=10) self.button1 = Button(self, text="Next",state="disabled", command=self.callback_choose) button2 = Button(self, text="Refresh", command=self.callback_refresh) button3 = Button(self, text="Back", command=self.callback_start) scrollbar = Scrollbar(self) self.mylist = Listbox(self, width=100, yscrollcommand = scrollbar.set ) self.mylist.bind("<Double-Button-1>", self.twoClick) self.button1.pack() button2.pack() button3.pack() # create list with a scroolbar scrollbar.pack( side = "right", fill="y" ) self.mylist.pack( side = "top", fill = "x", ipadx=20, ipady=20, padx=20, pady=20 ) scrollbar.config( command = self.mylist.yview ) # create a progress bar label2 = Label(self, text="Refresh progress bar", justify='center', anchor='center') label2.pack(side="top", fill="x") self.bar_lenght = 200 self.pb = Progressbar(self, length=self.bar_lenght, mode='determinate') self.pb.pack(side="top", anchor='center', ipadx=20, ipady=20, padx=10, pady=10) self.pb.config(value=0)
def initUI(self): information = Label(self,text = " \n Information on "+business_list[int(business_index)]['name']+"\n \n Located at: \n " + business_list[int(business_index)]['full_address'] ) information.pack() num_reviews = Label(self, text = "Number of Reviews : " + str(business_list[int(business_index)]['review_count']) ) num_reviews.pack() type = Label(self, text = "Type of Restaurant : " + str(business_list[int(business_index)]['type']) ) type.pack() cat = business_list[int(business_index)]['categories'] text_cat = '' for item in cat: text_cat = text_cat + ", " + item categories = Label(self, text = "Category of the resaurtant "+ text_cat ) categories.pack() w = Label(self, text=" \n Write a Review for "+business_list[int(business_index)]['name'] ) w.pack() e = Text(self, height=20, width=100) e.insert(END,"Insert Review Here") e.pack() b = Button(self, text="Submit Review",command=lambda: self.tostars(e.get(1.0, END))) b.pack(side=BOTTOM, fill=BOTH) self.pack(fill=BOTH, expand=1)
def initUI(self): Config.read("config.ini") Config.sections() derecha = ConfigSectionMap("Movimientos")['derecha'] izquierda = ConfigSectionMap("Movimientos")['izquierda'] disparo = ConfigSectionMap("Movimientos")['disparo'] salto = ConfigSectionMap("Movimientos")['salto'] derecha=int(derecha) izquierda=int(izquierda) disparo=int(disparo) salto=int(salto) self.parent.title("Place of dead - [Configuration]") self.style = Style() #self.style.theme_use("default") self.style.configure('My.TFrame', background='gray') #Layouts frame1 = Frame(self) frame1.pack(fill=Y) frame2 = Frame(self) frame2.pack(fill=Y) frame3 = Frame(self) frame3.pack(fill=Y) frame4 = Frame(self) frame4.pack(fill=Y) frame5 = Frame(self) frame5.pack(fill=Y) frame6 = Frame(self) frame6.pack(fill=Y) self.pack(fill=BOTH, expand=1) self.labela = Label(frame2, text="Movimiento a la derecha: ")#, textvariable=self.var) self.labela.pack(side=LEFT) derechae = Entry(frame2,width=9) derechae.insert(END, str(retornarletra(derecha))) derechae.pack(side=LEFT,padx=1, pady=1, expand=True) self.labelb = Label(frame3, text="Movimiento a la derecha: ")#, textvariable=self.var) self.labelb.pack(side=LEFT) izquierdae = Entry(frame3,width=9) izquierdae.insert(END, str(retornarletra(izquierda))) izquierdae.pack(side=LEFT,padx=1, pady=1, expand=True) self.labelc = Label(frame4, text="Salto: ")#, textvariable=self.var) self.labelc.pack(side=LEFT) saltoe = Entry(frame4,width=9) saltoe.insert(END, str(retornarletra(salto))) saltoe.pack(side=LEFT,padx=1, pady=1, expand=True) self.labeld = Label(frame5, text="Ataque: ")#, textvariable=self.var) self.labeld.pack(side=LEFT) disparoe = Entry(frame5,width=9) disparoe.insert(END, str(retornarletra(disparo))) disparoe.pack(side=LEFT,padx=1, pady=1, expand=True) okButton = Button(frame6, text="Save", command=lambda: self.save(derechae.get(),izquierdae.get(),saltoe.get(),disparoe.get())) okButton.pack(side=RIGHT)
class Login(Frame): """******** Funcion: __init__ ************** Descripcion: Constructor de Login Parametros: self Login parent Tk Retorno: void *****************************************************""" def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() """******** Funcion: initUI ************** Descripcion: Inicia la interfaz grafica de un Login, para ello hace uso de Frames y Widgets. Parametros: self Login Retorno: void *****************************************************""" def initUI(self): self.parent.title("Pythagram: Login") self.style = Style() self.style.theme_use("default") self.frame = Frame(self, relief=RAISED) self.frame.pack(fill=BOTH, expand=1) self.instructions = Label(self.frame,text="A new Web Browser window will open, you must log-in and accept the permissions to use this app.\nThen you have to copy the code that appears and paste it on the next text box.") self.instructions.pack(fill=BOTH, padx=5,pady=5) self.codeLabel = Label(self.frame,text="Code:") self.codeLabel.pack(fill=BOTH, padx=5,pady=5) self.codeEntry = Entry(self.frame) self.codeEntry.pack(fill=BOTH, padx=5,pady=5) self.pack(fill=BOTH, expand=1) self.closeButton = Button(self, text="Cancel", command=self.quit) self.closeButton.pack(side=RIGHT, padx=5, pady=5) self.okButton = Button(self, text="OK", command=self.login) self.okButton.pack(side=RIGHT) """******** Funcion: login ************** Descripcion: Luego que el usuario ingresa su codigo de acceso, hace la solicitud al servidor para cargar su cuenta en una ventana de tipo Profile Parametros: self Retorno: Retorna... *****************************************************""" def login(self): code = self.codeEntry.get() api = InstagramAPI(code) raw = api.call_resource('users', 'info', user_id='self') data = raw['data'] self.newWindow = Toplevel(self.parent) global GlobalID GlobalID = data['id'] p = Profile(self.newWindow,api,data['id'])
def initUI(self): scrollbar = Scrollbar(self) scrollbar.pack(side=RIGHT, fill=Y) dirLabel = Label( self, text="Directory Path of all files", ) dirLabel.pack(side=TOP) fileText = Entry(self, text="test", width=90) fileText.pack(side=TOP) outputLabel = Listbox(self, yscrollcommand=scrollbar.set, width=90) outputLabel.pack(side=TOP) var = StringVar(self) var.set("format type") # initial value menu = OptionMenu(self, var, "png", "jpg") menu.pack(side=TOP) self.parent.title("Bulk Image Converter") self.style = Style() #self.style.theme_use("clam") frame = Frame(self, relief=RAISED) frame.pack(fill=NONE, expand=True) self.pack(fill=BOTH, expand=True) def image(text, var): from PIL import Image import glob, os import sys #/Users/augustus/Pictures/iep/ filepath = text print('working....\n') if not os.path.exists(filepath): print('not a file path\n' + filepath) for file in glob.glob(filepath + "/*.*"): im = Image.open(file) file = file.strip("../") file = file.strip(".jpg") file = file.strip(".jpeg") file = file.strip(".png") file = file.strip(".tiff") file = file.strip(filepath) if not os.path.exists(filepath + "output"): os.makedirs(filepath + "output") print(file) outputLabel.insert(END, file) if var == "jpg": im.save(filepath + "output/" + file + ".jpg", "JPEG") elif var == "png": im.save(filepath + "output/" + file + ".png", "PNG") else: im.save(filepath + "output/" + file + ".jpg", "JPEG") def fileTextDef(): image(fileText.get(), var.get()) okButton = Button(self, text="OK", command=fileTextDef) okButton.pack(side=RIGHT)
def initUI(self): self.parent.title("Kinect Controlled Quadcopter") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=True) self.pack(fill=BOTH, expand=True) run_button = Button(self, text="Run", command = self.openFile) run_button.pack(side=RIGHT)
def buttonbox(self): box = Frame(self) btn = Button(box, text="Create", width=10, command=self.newP, default=ACTIVE) btn.pack(side=LEFT, padx=5, pady=5) box.pack()
def initUI(self): self.parent.title("Test the Gauss point") self.pack(fill=BOTH, expand=True) self.fields = \ 'bulk_modulus', \ 'scale_hardening', \ 'max_stress_in', \ 'increment_strain', \ 'Nloop', \ 'initial_confinement', \ 'reference_pressure', \ 'modulus_n', \ 'cohesion', \ 'RMC_shape_k', \ 'dilation_angle_eta', \ 'diletion_scale' default_values = \ '1E7', \ '1E3', \ '3E4', \ '1E-4', \ '2', \ '1E5', \ '1E5', \ '0.7', \ '0.0', \ '1.0', \ '1.0', \ '1.0' # ================== # Entries for User input: self.entries = [] for idx, field in enumerate(self.fields): row = Frame(self) row.pack(fill=X) labl = Label(row, text=field, width=30) labl.pack(side=LEFT, padx=5, pady=5) entry = Entry(row) entry.insert(END, default_values[idx]) entry.pack(fill=X, padx=5, expand=True) self.entries.append((field, entry)) # print field # ================== # Button for calculation frameButtonCalc = Frame(self) frameButtonCalc.pack(fill=X) calcButton = Button(frameButtonCalc, text="calculate", command=self.calculate) calcButton.pack(side=LEFT, padx=5, pady=5) # ================== # Raw Frame for plot self.canvasFrame = Frame(self) self.canvasFrame.pack(fill=BOTH, expand=True)
def initUI(self): self.parent.title("Team 604 Scouting App - ver. 0.2") self.style = Style() self.style.theme_use("default") frame1 = Frame(self, relief=RAISED, borderwidth=1) frame1.pack(fill=NONE, expand=1) #Key Functions dataPopulationButton = Button(self, te1xt="Data Population", command=Data_Population, width=12) dataPopulationButton.pack() teamLookupButton = Button(self, text="Export", # Export module needs to be made width=12) teamLookupButton.pack() teamRankingButton = Button(self, text="Team Ranking", command=Team_Ranking, width=12) teamRankingButton.pack() teamEntryDeletionButton = Button(self, text="Match Deletion", width=12) #TODO: Make TeamEntryDeletion GUI teamEntryDeletionButton.pack() #Formatting to look pretty frame2 = Frame(self, relief=RAISED, borderwidth=1) frame2.pack(fill=NONE, expand =1) quitButton = Button(self, text="Quit", command=self.quit) quitButton.pack(side=RIGHT, padx=15, pady=5) #TODO: Fix Button placement self.pack(fill=BOTH, expand=1)
def ventanaImprimir(self): t = Toplevel(self) t.wm_title("Imprimir") Label(t, text="Numero de Copias por etiqueta").pack() w = Spinbox(t, from_=1, to=10) w.pack() buttonImprimir = Button(t, text="Imprimir", command=lambda:self.imprimir(int(w.get()),t)) buttonImprimir.pack()
def initUI(self, parser) : # TODO required arguments # TODO repeated arguments (e.g. filenames) self.parent.title(self.progname) self.pack(fill=BOTH, expand=1) self.centerWindow() Grid.rowconfigure(self,1,weight=1) Grid.columnconfigure(self,0,weight=1) inputFrame = Frame(self) inputFrame.grid(row=0, column=0, sticky='WE') outputFrame = Frame(self) outputFrame.grid(row=1, column=0, sticky='WENS') self.outputText = ReadOnlyText(outputFrame) self.outputText.pack(fill=BOTH, expand=1) # Main controls frame mainFrame = Frame(inputFrame) mainFrame.pack(fill=BOTH, expand=1) # Auto-resize column Grid.columnconfigure(mainFrame,1,weight=1) # Ok button okButton = Button(inputFrame, text='Run', command=self.run, default='active') okButton.pack(side=RIGHT, padx=5, pady=5) # Cancel button cancelButton = Button(inputFrame, text='Exit', command=self.quit) cancelButton.pack(side=RIGHT) # Add controls to mainframe for all options for index, action in enumerate(parser._actions) : action_type = type(action).__name__ if action_type == '_HelpAction' : pass else : self.function.append(lambda v : [v]) self.variables.append(None) if action.choices : self._add_choice( mainFrame, index, action.dest, action.choices, action.default, action.option_strings[0] ) elif action_type == '_StoreTrueAction' : self._add_check( mainFrame, index, action.dest, False, action.option_strings[0] ) elif action_type == '_CountAction' : self._add_count( mainFrame, index, action.dest, 0, action.option_strings[0] ) elif action.type and action.type.__name__ == 'inputfile' : self._add_filename( mainFrame, index, action.dest, 'r', action.option_strings ) elif action.type and action.type.__name__ == 'outputfile' : self._add_filename( mainFrame, index, action.dest, 'w', action.option_strings ) else : self._add_field( mainFrame, index, action.dest )
def initUI(self): self.parent.title("URL OPENER") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand = 1) def getInput(): print "received input" googleButton = Button(self, text = "Google", command= lambda : browserOpener.openIESite('www.google.com')) googleButton.pack() ignButton = Button(self, text = "IGN", command = lambda : browserOpener.openIESite('www.ign.com')) ignButton.pack()
def main(): master = Tk() master.geometry("300x200+300+300") secApp = mainMenu(master) executeButton = Button(master, text="Run", command=secApp.executeChecks) executeButton.pack(side=LEFT) quitButton = Button(master, text="Quit", command=quit) quitButton.pack(side=RIGHT) master.mainloop()
def __init__(self,master,customers,payments,refresh): Frame.__init__(self,master) self.customers = customers self.payments = payments self.master = master self.refresh = refresh btn = Button(self,text="Open Check In Dialog",command=self.logger_diag, width=40) btn.pack(padx=100,pady=50) self.logger_diag = None
def initUI(self): self.parent.title("Review") self.pack(fill=BOTH, expand=True) labelfont20 = ('Roboto', 20, 'bold') labelfont12 = ('Roboto', 12, 'bold') frame0 = Frame(self) frame0.pack() lbl0 = Label(frame0, text="Hi USER") lbl0.config(font=labelfont20) lbl0.pack( padx=5, pady=5) lbl00 = Label(frame0, text="Search here") lbl00.config(font=labelfont12) lbl00.pack( padx=5, pady=5) frame1 = Frame(self) frame1.pack() lbl1 = Label(frame1, text="min %", width=9) lbl1.pack(side=LEFT, padx=7, pady=5) self.entry1 = Entry(frame1,width=20) self.entry1.pack(padx=5, expand=True) frame6 = Frame(self) frame6.pack() closeButton = Button(frame6, text="Get Names",width=12,command=self.getDate) closeButton.pack(padx=5, pady=5) frame7 = Frame(self) frame7.pack() closeButton1 = Button(frame7, text="Open in excel",width=15,command=self.openDate) closeButton1.pack(padx=5, pady=5) frame000 = Frame(self) frame000.pack() self.lbl000= Label(frame000, text=" ") self.lbl000.config(font=labelfont12) self.lbl000.pack( padx=5, pady=5) frame00a = Frame(self) frame00a.pack() self.lbl00a= Label(frame000, text=" ") self.lbl00a.pack( padx=5, pady=5)
def help_f(self): top = Toplevel() top.title("HELP") msg = Message(top, width= 500, text="Noise Threshold (NT) - Noise Based Main Threshold \ (Sigmas)\n Threshold 1 - Main Threshold (LSBs) \n Threshold 2 - End of Pulse Error \n \ Threshold 3 - End of Tail Error \n When Thr1 = Thr3 = 0 their values are defined as: \n \ (THR1 = NT (LSBs) / THR3 = NT*NOISE_ADC / 5)") msg.pack() button = Button(top, text="Close", command=top.destroy) button.pack()
def initUI(self): self.parent.title("Review") self.pack(fill=BOTH, expand=True) labelfont20 = ('Roboto', 20, 'bold') labelfont12 = ('Roboto', 12, 'bold') frame0 = Frame(self) frame0.pack() lbl0 = Label(frame0, text="Hi USER") lbl0.config(font=labelfont20) lbl0.pack(padx=5, pady=5) lbl00 = Label(frame0, text="Search here") lbl00.config(font=labelfont12) lbl00.pack(padx=5, pady=5) frame1 = Frame(self) frame1.pack() lbl1 = Label(frame1, text="min %", width=9) lbl1.pack(side=LEFT, padx=7, pady=5) self.entry1 = Entry(frame1, width=20) self.entry1.pack(padx=5, expand=True) frame6 = Frame(self) frame6.pack() closeButton = Button(frame6, text="Get Names", width=12, command=self.getDate) closeButton.pack(padx=5, pady=5) frame7 = Frame(self) frame7.pack() closeButton1 = Button(frame7, text="Open in excel", width=15, command=self.openDate) closeButton1.pack(padx=5, pady=5) frame000 = Frame(self) frame000.pack() self.lbl000 = Label(frame000, text=" ") self.lbl000.config(font=labelfont12) self.lbl000.pack(padx=5, pady=5) frame00a = Frame(self) frame00a.pack() self.lbl00a = Label(frame000, text=" ") self.lbl00a.pack(padx=5, pady=5)
def help_f(self): top = Toplevel() top.title("HELP") msg = Message(top, width=500, text="Noise Threshold (NT) - Noise Based Main Threshold \ (Sigmas)\n Threshold 1 - Main Threshold (LSBs) \n Threshold 2 - End of Pulse Error \n \ Threshold 3 - End of Tail Error \n When Thr1 = Thr3 = 0 their values are defined as: \n \ (THR1 = NT (LSBs) / THR3 = NT*NOISE_ADC / 5)") msg.pack() button = Button(top, text="Close", command=top.destroy) button.pack()
def initUI(self): self.parent.title("Simple FTP-Client") self.pack(fill=BOTH, expand=True) # self.parent.title("Buttons") #frame2 = Frame(self) #frame2.pack(anchor=W,side=LEFT) #lbl2 = Label(frame2, text="Command Line", width=6) #lbl2.pack(fill=X,anchor=W,expand=True,padx=5, pady=5) #txt2 = Text(frame2) #txt2.pack(fill=X,side=BOTTOM,pady=5, padx=5) frame3 = Frame(self, width=400, height=500) frame3.pack(side=BOTTOM,anchor=NW) lbl3 = Label(frame3, text="Command Line", width=6) lbl3.pack(fill=X,anchor=NE,expand=True,padx=5, pady=5) txt = Text(frame3) txt.pack(fill=BOTH,pady=5, padx=5) wid = frame3.winfo_id() os.system('xterm -into %d -geometry 400x400 -sb &' % wid) f1 = Frame(self) f1.pack(fill=X,side=LEFT, anchor=NW, padx=5, pady=10) lb=Label(f1, text="Host:").grid(row=0, column=0) e1 = Entry(f1) e1.grid(row=0, column=1, padx=1) f2 = Frame(self) f2.pack(fill=X,side=LEFT, anchor=NW, padx=5, pady=10) lb2=Label(f2, text="Username:"******"Password:"******"Port:").grid(row=0, column=2) e4 = Entry(f4) e4.grid(row=0, column=3, padx=5) connectButton = Button(self, text="Connect", command=callback) connectButton.pack(expand=True,fill=X,side=LEFT, anchor=NW, padx=10, pady=10)
def drawObject(self, index): objectType = str(self.drawOnScreenList[index].getObjectType()) if(objectType is 'Button'): #if both command and lambda command are None if((self.drawOnScreenList[index].getCommand() is None) and (self.drawOnScreenList[index].getLambdaCommand() is None)): tempName= Button(self, text=str(self.drawOnScreenList[index].getText()), textvariable=self.drawOnScreenList[index].getStringVariable() ) #elif lambda command is not none but command is none elif((self.drawOnScreenList[index].getCommand() is None) and (self.drawOnScreenList[index].getLambdaCommand() is not None)): tempName= Button(self, text=str(self.drawOnScreenList[index].getText()), textvariable=self.drawOnScreenList[index].getStringVariable(), command=self.drawOnScreenList[index].getLambdaCommand()) #elif command is not None and lambda is none elif((self.drawOnScreenList[index].getCommand() is not None) and (self.drawOnScreenList[index].getLambdaCommand() is None)): tempName= Button(self, text=str(self.drawOnScreenList[index].getText()), textvariable=self.drawOnScreenList[index].getStringVariable(),command=self.drawOnScreenList[index].getCommand( )) else: raise Exception("drawScreen error: command and lambda command are both not None!") tempName.pack(side=str(self.drawOnScreenList[index].getSide()), padx=int(self.drawOnScreenList[index].getPadx()), pady=int(self.drawOnScreenList[index].getPady())) #end of if button elif(objectType is 'Label'): tempName= Label(self, text=str(self.drawOnScreenList[index].getText()), textvariable= self.drawOnScreenList[index].getStringVariable()) tempName.pack(side=str(self.drawOnScreenList[index].getSide()), padx=int(self.drawOnScreenList[index].getPadx()), pady=int(self.drawOnScreenList[index].getPady())) #end of if label elif(objectType is 'Entry'): tempName= Entry(self, bd=5, textvariable= self.drawOnScreenList[index].getTextVariable()) tempName.pack(side=str(self.drawOnScreenList[index].getSide()), padx=int(self.drawOnScreenList[index].getPadx()), pady=int(self.drawOnScreenList[index].getPady())) #end of if Entry elif(objectType is 'RadioButton'): tempName= Radiobutton(self, text=str(self.drawOnScreenList[index].getText()), variable=self.drawOnScreenList[index].getVariable(), value=self.drawOnScreenList[index].getValue() ) tempName.pack(side=str(self.drawOnScreenList[index].getSide()), padx=int(self.drawOnScreenList[index].getPadx()), pady=int(self.drawOnScreenList[index].getPady())) #end of if Radiobutton else: raise Exception("drawOnScreen ERROR: unrecognized objectType: '"+str(objectType)+"'")
def initUI(self): self.parent.title("Tomates") self.pack(fill=BOTH, expand=True) Style().configure("TFrame", background="#333") # self.imagen("inicio.jpg") self.salida1("") self.salida2("") self.salida3("") self.estado("") AbrirButton = Button(self, text="Abrir") AbrirButton.pack(side=RIGHT, padx=5, pady=5) AbrirButton.place(x=800, y=25) AbrirButton["command"] = self.abrir label = Label(self, text="Datos de salida", fg="#F66", bg="#333", font="Helvetica 16 bold italic") label.place(x=550, y=60) label = Label(self, text="P Salida1:", fg="#FF5", bg="#333", font="Helvetica 16 bold italic") label.place(x=500, y=150) label = Label(self, text="M Salida2:", fg="#FF5", bg="#333", font="Helvetica 16 bold italic") label.place(x=500, y=200) label = Label(self, text="V Salida3:", fg="#FF5", bg="#333", font="Helvetica 16 bold italic") label.place(x=500, y=250) label = Label(self, text="Estado del tomate:", fg="#0040ff", bg="#333", font="Helvetica 16 bold italic") label.place(x=500, y=300) """
def initUI(self): self.parent.title("Buttons") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=True) self.pack(fill=BOTH, expand=True) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self, text="OK") okButton.pack(side=RIGHT)
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) projectButton = Button(self, text=self.project[0]["name"], style="Medium.TButton", command=lambda: self.btnFn(0)) projectButton.pack(side=RIGHT) projectButton = Button(self, text=self.project[1]["name"], style="Medium.TButton", command=lambda: self.btnFn(1)) projectButton.pack(side=RIGHT) projectButton = Button(self, text=self.project[2]["name"], style="Medium.TButton", command=lambda: self.btnFn(2)) projectButton.pack(side=RIGHT)
def goal_button_widget(self): frame = Frame(self) frame.pack(padx=0, pady=0, side='top') buttons = Button(frame, text="Home Goal", command=lambda: self._goal_scored('home'), style="goal.TButton") buttons.pack(padx=5, pady=20, side='top') buttons = Button(frame, text="Away Goal", command=lambda: self._goal_scored('away'), style="goal.TButton") buttons.pack(padx=5, pady=20, side='top')
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 login_GUI(): global rootL, entryA, entryB, entryC, errorText, errors, loginButton rootL = Tk() #Base rootL.title("Babble Login") rootL.style = Style() rootL.style.theme_use("alt") w = 250 h = 150 rootL.geometry("%dx%d+50+25" % (w, h)) #Base rowBuffer = Frame(rootL) labelBuffer = Label(rowBuffer, text=" ") #Buffer @ top of App labelBuffer.pack() rowBuffer.pack(side = TOP, fill = X) #Host/Ip/Username rowA = Frame(rootL) labelA = Label(rowA, width = 10, text="IP:") entryA = Entry(rowA, width = 15) rowA.pack(side = TOP, fill = X) labelA.pack(side = LEFT) entryA.pack(side = LEFT, expand=NO) rowB = Frame(rootL) labelB = Label(rowB, width = 10, text="Port:") entryB = Entry(rowB, width = 15) rowB.pack(side = TOP, fill = X) labelB.pack(side = LEFT) entryB.pack(side = LEFT, expand=NO) rowC = Frame(rootL) labelC = Label(rowC, width = 10, text="Username:"******"") errors = Label(rootL, textvariable=errorText) errors.pack(side=BOTTOM) loginButton = Button(rootL, text = "Login", command = (lambda: loggingIn())) loginButton.pack(side = TOP) #Login Button/Errors rootL.mainloop()
def initUI(self): self.parent.title("Chaos Dungeon Generator") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=True) self.pack(fill=BOTH, expand=True) closeButton = Button(self, text="Quit", command=quit) closeButton.pack(side=LEFT, padx=5, pady=5) okButton = Button(self, text="Start", command=self.generateRoom) okButton.pack(side=LEFT)
def initUI(self): self.parent.title("Pythagram: Search") self.style = Style() self.style.theme_use("default") self.frame = Frame(self,relief=RAISED) self.frame.pack(fill=BOTH, expand=1) searchLabel = Label(self.frame, text="Search") self.searchEntry = Entry(self.frame) searchLabel.pack(fill=BOTH, padx=5,pady=5) self.searchEntry.pack(fill=BOTH, padx=5,pady=5) self.pack(fill=BOTH, expand=1) okButton = Button(self, text="OK", command=self.search) okButton.pack(side=RIGHT, padx=5, pady=5)
def initUI(self): self.parent.title("Content recommendation - Test prototype") self.style = Style() self.style.theme_use("clam") self.pack(fill=BOTH, expand=1) # Create the buttons quitButton = Button(self, text="Quit", command=self.quit) quitButton.pack() global content_seen content_seen = StringVar() content_seen.set("0/" + str(MAX_CONTENT)) button = Button(self, text="Show next content", command=lambda: go_next(button, content_seen)) button.pack() if MAX_CONTENT: Label(self, textvariable=content_seen).pack()
def __init__(self, master): self.master = master self.book = Books() self.frameTableOptions = Frame(master) self.frameTableOptions.pack(expand=True, fill="both") self.frameOptions = Frame(self.frameTableOptions, background="#B4CDCD") self.frameOptions.pack(side=BOTTOM, fill="both", padx=5, pady=5) b1 = TButton(self.frameOptions, text="Marcar", command=self.actionWindowEditMarker) b1.pack(side=LEFT, padx=5, pady=5) b2 = TButton(self.frameOptions, text="Alterar Info", command=self.actionWindowEditInfo) b2.pack(side=LEFT, padx=5, pady=5) PopupHelp(master, b1, u"Move o marcador para a página atual de leitura do livro") PopupHelp(master, b2, u"Altera informações do livro") headers = (("namebook", ("nome do livro", 50)), ("totalpages", ("total pags", 10)), ("pagebreak", ("pag pausada", 10)), ("initRead", ("inicio leitura", 10))) self.table = table = Table(master=self.frameTableOptions, headers=headers, find_field="namebook") table.bind("<Button-1>", table.selectRowEvent) table.bind("<Up>", table.selectPreviousRowEvent, type="only", action="up") table.bind("<Down>", table.selectNextRowEvent, type="only", action="down") table.bind("<MouseWheel>", table.mouseWheelEvent, action="wheel") table.pack(side=TOP, padx=5, pady=5, expand=True, fill="both") self.setDatasTable( ) #Funcao para inserir as linhas de acordo com os dados do self.book.getRecordsDb table.updateRegion() table.selectRowByNumberLine(row=1)
def generateRoom(self): ''' Generates the Room() object and displays it in a window. ''' # Up here should be user inputs that pop up first, but right now # just making the window and a randomly generated room. # Clearing out any previous stuff if self.room: self.roomframe.destroy() self.room = False # Setting the lvl variable lvl = IntVar() lvl.set(1) # Button commands (contained here for a reason) def upLevel(): lvl.set(lvl.get() + 1) roomframe.update() print lvl.get() def downLevel(level): lvl.set(lvl.get() + 1) # Generating the new frame for the room self.roomframe = Frame(self.parent, borderwidth=1) self.room = True # up = Button(self.roomframe, text='+') down = Button(self.roomframe, text='-') up.pack(side=TOP) down.pack(side=TOP) # Generating the Room() object and storing it as an attribute self.current_room = Room(shape="Rectangle") outstr = self.current_room.roomString(level=lvl.get()) print self.current_room.size, self.current_room.shape room_label = Label(self.roomframe, text=outstr, fg="white", bg="black", justify=LEFT, anchor=W, font=('Courier', '12')) room_label.pack() #side=BOTTOM, fill = BOTH) # Packing the room's frame self.roomframe.pack(side=BOTTOM, fill=BOTH, expand=True)
def popupWindowStaleMate(self, msg): popup = tk.Tk() popup.wm_attributes("-topmost", 1) popup.focus_force() popup.wm_title("End of Game!") label = Label(popup, text=msg, font=("Helvetica", 16), anchor=tk.CENTER, relief='groove') label.pack(side="top", fill="x", pady=10) B1 = Button(popup, text="?????? Start New Game ??????", command=lambda popup=popup: self.endOfGameButton(popup)) B1.pack() popup.mainloop()
def help_f(self): top = Toplevel() top.title("HELP") msg = Message(top, width=500, text="COEFF Calibration Procedure: \n \ Input Start Point and Length of the pulse \n \ Input an initial guess of the pulse amplitude \n \ Use a ROI with at least 1000 samples of baseline \n \ and 1000 samples after pulse end \n \ Adjust loop range and step until a graph error \n \ with a minimum is observed \n \ Refine the search to increase precision") msg.pack() button = Button(top, text="Close", command=top.destroy) button.pack()
def NouveauLance(): global q global q1 if (len(q.questionAVenir) != 0): q1 = q.repondreQuestion() Texte.set(q1["question"]) else: Texte.set("Est-ce bien ca ?\n" + str(q.instanceMoteur.getMaxScore())) print q.instanceMoteur.getMaxScore() fin = Toplevel() fin.grab_set() Labelres = Label(fin, textvariable=Texte, fg='red', bg='white') Labelres.pack() a = Button(fin, text='Oui', command=Ok) a.pack() b = Button(fin, text='Non', command=Ko) b.pack()
def __init__(self, parent, speed=100, fname='map.txt', algo=uniform_cost_search, run=False, jump=False): Frame.__init__(self, parent) self.parent = parent self.path = None self.grid_view = None self.speed = speed self.algo = algo self.run = run self.jump = jump self.parent.title("Search Visualizer") self.style = Style().configure("TFrame", background="#333") self.tile_size = tile_size = 16 self.grid_view = Grid(self, self.tile_size) self.grid_view.pack(fill=BOTH, expand=True) self.grid_view.canvas.bind('<Button-1>', self._on_mouse_click) self.g = None self.h = None self.last_hover = None self.step_num = 0 self.load_map(fname) self.pack(fill=BOTH, expand=True) self.stepCounter = Label(self, text="Count: 000") self.stepCounter.pack(side=LEFT, padx=5, pady=5) self.algoLabel = Label(self, text="g: h: f:") self.algoLabel.pack(side=LEFT, padx=5, pady=5) # TODO Check boxes to select heuristic # TODO Button to select algorithm and restart quitButton = Button(self, text="Quit", command=self.quit) quitButton.pack(side=RIGHT, padx=5, pady=5) stepButton = Button(self, text="Step", command=self._step_button) stepButton.pack(side=RIGHT, padx=5, pady=5) pauseButton = Button(self, text="Start/Stop", command=self._pause_toggle) pauseButton.pack(side=RIGHT) jumpButton = Button(self, text="End", command=self._jump_button) jumpButton.pack(side=RIGHT, padx=5, pady=5) self.bind("<space>", self._pause_toggle) self.bind("<q>", self._quit) self.centerWindow()
def __init__(self, master=None, title=None, message=None, data = []): self.master = master self.value = None self.data = data self.modalPane = Toplevel(self.master) self.modalPane.transient(self.master) self.modalPane.grab_set() self.modalPane.bind("<Return>", self._choose) self.modalPane.bind("<Escape>", self._cancel) self.modalPane.columnconfigure(0, pad = 5, weight = 1) self.modalPane.rowconfigure(0, pad = 5) self.modalPane.rowconfigure(1, pad = 5, weight = 1) self.modalPane.rowconfigure(2, pad = 5) if title: self.modalPane.title(title) if message: Label(self.modalPane, text=message).grid(row = 0, column = 0, padx = 10, sticky = W+E) listFrame = Frame(self.modalPane) listFrame.grid(row = 1, column = 0, sticky = W+E) scrollBar = Scrollbar(listFrame) scrollBar.pack(side=RIGHT, fill=Y) self.listBox = Listbox(listFrame, selectmode = SINGLE) self.listBox.pack(side = LEFT, fill = BOTH, expand = True) scrollBar.config(command = self.listBox.yview) self.listBox.config(yscrollcommand=scrollBar.set) for item in self.data: self.listBox.insert(END, item) buttonFrame = Frame(self.modalPane) buttonFrame.grid(row = 2, column = 0, sticky = W+E) chooseButton = Button(buttonFrame, text="Choose", command=self._choose) chooseButton.pack(padx=5, pady=5, side = LEFT) cancelButton = Button(buttonFrame, text="Cancel", command=self._cancel) cancelButton.pack(padx=5, pady=5, side=RIGHT)
def initUI(self): frame = Frame(self, relief=RAISED, borderwidth=1, background="blue") frame.pack(fill=BOTH, expand=1) self.columnconfigure(0, pad=3) self.columnconfigure(1, pad=3) self.columnconfigure(2, pad=3) self.columnconfigure(3, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(1, pad=3) self.rowconfigure(2, pad=3) self.rowconfigure(3, pad=3) self.rowconfigure(4, pad=3) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self, text="OK") okButton.pack(side=RIGHT)
def initUI(self): #make frame fill the rot window self.parent.title("Simple") self.pack(fill=BOTH, expand=1) #add text box to get course number self.entry_text = Entry(self) self.entry_text.pack() #add a button that will create a graph create_graph_button = Button(self, text="Create PNG Graph", command=self.create_PNG_graph) create_graph_button.pack() create_graph_button = Button(self, text="Create SVG Graph", command=self.create_SVG_graph) create_graph_button.pack()
def control_button_widget(self): frame = Frame(self, style='button.TFrame', padding=10) frame.pack(side='top', fill=BOTH) buttons = Button(frame, text="Start", command=self._start_timer) buttons.pack(padx=5, side='left') buttons = Button(frame, text="Stop", command=self._stop_timer) buttons.pack(padx=5, side='left') buttons = Button(frame, text="Reset", command=self._reset_timer) buttons.pack(padx=5, side='left') buttons = Button(frame, text="Quit", command=self._quit_timer) buttons.pack(padx=5, side='left')
def initUI(self): self.parent.title("Computação Gráfica - UFT") self.style = Style() self.style.theme_use("default") self.pack() # apenas um teste # botao para tracar a reta okButton = Button(self, text="OK") okButton.place(x=300, y=430) okButton.pack() # botao para fechar a aplicação quitButton = Button( self, text="Fechar", command=self.quit) # o titulo do botao deveria ser Sair quitButton.place( x=300, y=460) # posiciona o botão nas coordenadas aqui especificadas quitButton.pack()
def init_ui(self): self.parent_.title('Rough surface generator') self.pack(fill=BOTH, expand=True) # top panel with controls frame_top = Frame(self, background=self.TOP_FRAME_BACKGROUND_COLOR) frame_top.pack(fill=X) self.cb = Combobox(frame_top, values=('Gaussian', 'Laplace')) self.cb.current(0) self.cb.pack(side=LEFT, padx=5, expand=True) l1 = Label(frame_top, text=r'Cx', background=self.TOP_FRAME_BACKGROUND_COLOR, width=4) l1.pack(side=LEFT, padx=5, expand=True) self.entry1 = Entry(frame_top, validate='key', validatecommand=(self.register(self.on_validate), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'), width=10) self.entry1.pack(side=LEFT, padx=5, expand=True) self.entry1.insert(0, str(self.a_)) l1 = Label(frame_top, text=r'Cy', width=4, background=self.TOP_FRAME_BACKGROUND_COLOR) l1.pack(side=LEFT, padx=5) self.entry2 = Entry(frame_top, validate='key', validatecommand=(self.register(self.on_validate), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'), width=10) self.entry2.pack(side=LEFT, padx=5, expand=True) self.entry2.insert(0, str(self.b_)) but1 = Button(frame_top, text='RUN', command=self.button_action) but1.pack(side=RIGHT, padx=5, pady=5) # central panel. It will have a label with an image. Image may have a random noise state, or # transformed image state self.img_frame.pack(fill=BOTH, expand=True) img_label = Label(self.img_frame, background=None) img_label.pack(expand=True, fill=BOTH, padx=5, pady=5)
def initUI(self): self.parent.title("Test the Gauss point") self.pack(fill=BOTH, expand=True) self.fields = \ 'bulk_modulus', \ 'Scale_Hardening', \ 'max_strain_in', \ 'increment_strain', \ 'Nloop' default_values = \ '16750', \ '1', \ '1E-2', \ '1E-4', \ '0' # ================== # Entries for User input: self.entries = [] for idx, field in enumerate(self.fields): row = Frame(self) row.pack(fill=X) labl = Label(row, text=field, width=30) labl.pack(side=LEFT, padx=5, pady=5) entry = Entry(row) entry.insert(END, default_values[idx]) entry.pack(fill=X, padx=5, expand=True) self.entries.append((field, entry)) # print field # ================== # Button for calculation frameButtonCalc = Frame(self) frameButtonCalc.pack(fill=X) calcButton = Button(frameButtonCalc, text="calculate", command=self.calculate) calcButton.pack(side=LEFT, padx=5, pady=5) # ================== # Raw Frame for plot self.canvasFrame = Frame(self) self.canvasFrame.pack(fill=BOTH, expand=True)