class MainFrame(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("GSN Control Panel") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.turnOnBtn = Button(self, text="Turn On") self.turnOnBtn["command"] = self.turnOn self.turnOnBtn.grid(row=0, column=0) self.turnOffBtn = Button(self, text="Turn Off") self.turnOffBtn["command"] = self.turnOff self.turnOffBtn.grid(row=0, column=1) def turnOn(self): host.enqueue({"SM":"GSN_SM", "action":"turnOn", "gsnId":GSNID, "localIP":IP, "localPort":int(PORT)}) def turnOff(self): host.enqueue({"SM":"GSN_SM", "action":"turnOff"})
class Example(Frame): def __init__(self,parent): Frame.__init__(self, parent) self.parent = parent self.initUI() 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 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>>')
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Scale") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) scale = Scale(self, from_=0, to=100, command=self.onScale) scale.pack(side=LEFT, padx=15) self.var = IntVar() self.label = Label(self, text=0, textvariable=self.var) self.label.pack(side=LEFT) def onScale(self, val): v = int(float(val)) self.var.set(v)
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() 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) frame2 = Frame(self, relief=RAISED, borderwidth=2) frame2.pack(fill=BOTH, expand=1) self.pack(fill=BOTH, expand=1) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self, text="OK") okButton.pack(side=RIGHT)
class myApp(Frame): def __init__(self, parent): Frame.__init__(self, parent, background="white") self.parent = parent self.initUI() def initUI(self): w = self.parent.winfo_screenwidth()/2 h = self.parent.winfo_screenheight()/2 sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() x = (sw - w)/2 y = (sh - h)/2 self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y)) self.parent.title("myApp") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) quitButton = Button(self, text="Quit", command=self.quit) quitButton.place(x=w/2, y=h/2)
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) style = Style() style.configure("TFrame", background="#333")
class MainFrame(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() 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 quit(self): if MAX_CONTENT and content_number < MAX_CONTENT: result = tkMessageBox.askquestion("Quit", "Are you sure ? Your session is incomplete...", icon='warning') == 'yes' else: result = True if result: stop_detection() Frame.quit(self)
class AutoAim(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.makeButtons() def makeButtons(self): self.parent.title("AutoAim") self.style = Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) self.pack(fill=BOTH, expand=1) # put the option to generate in the bottom and the text entries in the lower left generate = Button(self, text="Generate", fg="red", command = getEntries) generate.pack(side=LEFT, padx=30, pady=30) emailTo = Button(self, text="Save Session", fg="red", command = file_save) emailTo.pack(side=LEFT, padx=30, pady=30) # put the option to generate a slow spiral slow = Button(self, text="Fine", fg="red", command = smallSpiral) slow.pack(side=RIGHT, padx=10, pady=20) # put the option to generate a quick spiral fast = Button(self, text="Coarse", fg="red", command = bigSpiral) fast.pack(side=RIGHT, padx=10, pady=10)
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) style = Style() style.configure("TFrame", background="#333") bard = Image.open("bardejov.jpg") bardejov = ImageTk.PhotoImage(bard) #We create an image object and a photo image object from an image in the current working directory. label1 = Label(self, image=bardejov) #We create a Label with an image. Labels can contain text or images. label1.image = bardejov #We must keep the reference to the image to prevent image from being garbage collected. label1.place(x=20, y=20) #The label is placed on the frame at x=20, y=20 coordinates. rot = Image.open("rotunda.jpg") rotunda = ImageTk.PhotoImage(rot) label2 = Label(self, image=rotunda) label2.image = rotunda label2.place(x=40, y=160) minc = Image.open("mincol.jpg") mincol = ImageTk.PhotoImage(minc) label3 = Label(self, image=mincol) label3.image = mincol label3.place(x=170, y=50)
class Example(Frame): def __init__(self,parent): Frame.__init__(self,parent) self.parent=parent self.initUI() def close_window(): root.destroy() 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) bard = Image.open("images.jpg") bardejov = ImageTk.PhotoImage(bard) label1 = Label(frame, image=bardejov) label1.image = bardejov label1.place(x=20, y=20) self.pack(fill=BOTH, expand=1) closebutton = Button(self, text="Close") closebutton.pack(side=RIGHT, padx=5, pady=5) okbutton = Button(self, text="OK") okbutton.pack(side=RIGHT)
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Message boxes") self.style = Style() self.style.theme_use("default") self.pack() error = Button(self, text="Error", command=self.onError) error.grid() warning = Button(self, text="Warning", command=self.onWarn) warning.grid(row=1, column=0) question = Button(self, text="Question", command=self.onQuest) question.grid(row=0, column=1) inform = Button(self, text="Information", command=self.onInfo) inform.grid(row=1, column=1) def onError(self): box.showerror("Error", "Could not open file") def onWarn(self): box.showwarning("Warning", "Deprecated function call") def onQuest(self): box.askquestion("Question", "Are you sure to quit?") def onInfo(self): box.showinfo("Information", "Download completed")
class CommAdd(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): # This should be different if running on Windows.... content = pyperclip.paste() print content self.entries_found = [] self.parent.title("Add a new command card") self.style = Style() self.style.theme_use("default") self.pack() self.new_title_label = Label(self, text="Title") self.new_title_label.grid(row=0, columnspan=2) self.new_title_entry = Entry(self, width=90) self.new_title_entry.grid(row=1, column=0) self.new_title_entry.focus() self.new_content_label = Label(self, text="Card") self.new_content_label.grid(row=2, columnspan=2) self.new_content_text = Text(self, width=110, height=34) self.new_content_text.insert(END, content) self.new_content_text.grid(row=3, columnspan=2) self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew) self.add_new_btn.grid(row=4) def onAddNew(self): pass
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Quit button") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) quitButton = Button(self, text="Quit", command=self.quit) quitButton.place(x=50, y=50) def display_bots: pass def
class Example(Frame): def __init__(self, parent): # Frame.__init__(self, parent, background="white") #Tkinter Frame Frame.__init__(self, parent) # ttk Frame self.parent = parent self.initUI() def initUI(self): self.parent.title("Drawing Window") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=True) frameL = Frame(self, relief=RAISED, borderwidth=2) frameL.pack(fill=BOTH, expand=True) lbMax = Label(frameL, text="Maximum Arrangment", width=25) lbMax.pack(side=TOP, padx=5, pady=5) canvas = Canvas(frameL) canvas.create_rectangle(30, 10, 120, 80, outline="#fff", fill="#fff") frameR = Frame(self, relief=RAISED, borderwidth=2) frameR.pack(fill=BOTH, expand=True) lbMin = Label(frameR, text="Minimum Arrangment", width=25) lbMin.pack(side=TOP, padx=5, pady=5) quitButton = Button(self, text="Quit", command=self.quit) quitButton.pack(side=RIGHT, padx=10, pady=10)
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) style = Style() style.configure("TFrame", background="#333") bard = Image.open("bardejov.jpg") bardejov = ImageTk.PhotoImage(bard) label1 = Label(self, image=bardejov) label1.image = bardejov label1.place(x=20, y=20) rot = Image.open("rotunda.jpg") rotunda = ImageTk.PhotoImage(rot) label2 = Label(self, image=rotunda) label2.image = rotunda label2.place(x=40, y=160) minc = Image.open("mincol.jpg") mincol = ImageTk.PhotoImage(minc) label3 = Label(self, image=mincol) label3.image = mincol label3.place(x=170, y=50)
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() 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)
class DialogScale(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Compression") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) scale = Scale(self, from_=0, to=255,command=self.onScale, orient= HORIZONTAL) scale.place(x=90, y=20) self.label2 = Label(self, text="Choisissez un niveau de compression") self.label2.place(x=52, y=0) self.quitButton = Button(self, text=" Ok ",command=self.ok) self.quitButton.place(x=120, y=65) def onScale(self, val): self.variable = int(val) def ok(self): global compress compress = self.variable self.quit()
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() 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) self.pack(fill=BOTH, expand=1) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) # 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 be okButton = Button(self, text="OK") okButton.pack(side=RIGHT)
class Example(Frame): def __init__(self,parent): Frame.__init__(self,parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("windows widget") 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=3, 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)
class TK_Framework(object): def __init__(self): self.root = Tk() # list of open windows self.windows = {'main':self.root} # setup the overall style of the gui self.style = Style() self.style.theme_use('clam') def get_window(self,name): return self.windows[name] def create_window(self, name): self.windows[name] = Toplevel() @staticmethod def open_file(init_dir): filename = askopenfilename(initialdir=init_dir) return filename def hide_root(self): """Hides the root window""" self.root.withdraw() def get_root(self): return self.root
class packManagerwButtons(Frame): #this uses the pack manager, there are also the grid manager and the geometry manager def __init__(self, parent): Frame.__init__(self,parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Buttons") self.style = Style() self.style.theme_use("default") #this is an additional frame frame = Frame(self,relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) self.pack(fill=BOTH, expand=1) closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self,text="OK") okButton.pack(side=RIGHT)
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() #setting up the GUI def initUI(self): #sets the title of the window self.parent.title("Do you dare to Zlatan?") self.style = Style() self.style.theme_use("alt") #creates an object for the window self.pack(fill=BOTH, expand=1) #makes buttons quitButton = Button(self, text="No, Zlatan sucks", command=self.quit) quitButton.place(x=30, y=50) webbutton = Button(self, text="Yes, #DaretoZlatan", command=self.OpenUrl) webbutton.place(x=130, y=50) #defines what the buttons do def quit(self): self.parent.destroy() def OpenUrl(self): webbrowser.open_new('https://www.youtube.com/watch?v=ia-zi5oLa_0')
class KnnFrame(Frame): def __init__(self, parent): Frame.__init__(self, parent, background="white") self.parent = parent self.style = Style() self.init_ui() def center_window(self): width_knn = 500 height_knn = 500 sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() x = (sw-width_knn)/2 y = (sh-height_knn)/2 self.parent.geometry('%dx%d+%d+%d' % (width_knn, height_knn, x, y)) def init_ui(self): self.parent.title("knn - Classification") self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.center_window() quit_button = Button(self, text="Close", command=self.quit) quit_button.place(x=50, y=50)
class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Buttons") self.style = Style() self.style.theme_use("default") #Pack the root frame self.pack(fill=BOTH, expand=1) #Create another frame frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) #Pack two buttons to the bottom right closeButton = Button(self, text="Close") closeButton.pack(side=RIGHT, padx=5, pady=5) okButton = Button(self, text="OK") okButton.pack(side=RIGHT)
class FACSMainWindow(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUIConstants() self.initUI() self.inputDirectory = "" self.outputDirectory = "" def initUIConstants(self): # defining options for opening a directory self.dir_opt = options = {} options['initialdir'] = 'C:\\' options['mustexist'] = False options['parent'] = self options['title'] = 'Select directory for FACS:' def initUI(self): self.parent.title("FACS machine output analyzer") self.style = Style() self.style.theme_use("default") self.pack() inputDir = Button(self, text='Select input directory', command=self.askInputDirectory) inputDir.grid(row=0, column=1) outputDir = Button(self, text="Select output directory", command=self.askOutputDirectory) outputDir.grid(row=1) processFiles = Button(self, text="Process", command=self.processData) processFiles.grid(row=2) def onError(self): box.showerror("Error", "Could not open file") def onWarn(self): box.showwarning("Warning", "Deprecated function call") def onQuest(self): box.askquestion("Question", "Are you sure to quit?") def onProcessingEnd(self): box.showinfo("Information", "Processing complete!\n\nOutput location" + self.outputDirectory) def askInputDirectory(self): """Returns a selected directoryname.""" self.inputDirectory = tkFileDialog.askdirectory(**self.dir_opt) def askOutputDirectory(self): """Returns a selected directoryname.""" self.outputDirectory = tkFileDialog.askdirectory(**self.dir_opt) def processData (self): self.onProcessingEnd();
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'])
class MainFrame(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Driver Control Panel") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.label = Label(self, text="Bus Tracker - Driver", font=('Helvetica', '21')) self.label.grid(row=0, column=0) self.l = Label(self, text="Bus Line", font=('Helvetica', '18')) self.l.grid(row=1, column=0) self.e = Entry(self, font=('Helvetica', '18')) self.e.grid(row=2, column=0) self.l = Label(self, text="Direction", font=('Helvetica', '18')) self.l.grid(row=3, column=0) # add vertical space self.l = Label(self, text="", font=('Helvetica', '14')) self.l.grid(row=5, column=0) self.e = Entry(self, font=('Helvetica', '18')) self.e.grid(row=4, column=0) self.search = Button(self, text="Start") self.search.grid(row=6, column=0) ######### used for debug ########## # add vertical space self.l2 = Label(self, text="", font=('Helvetica', '14')) self.l2.grid(row=5, column=0) self.turnOnBtn = Button(self, text="Turn On") self.turnOnBtn["command"] = self.turnOn self.turnOnBtn.grid(row=6, column=0) self.startBtn = Button(self, text="Start") self.startBtn["command"] = self.start self.startBtn.grid(row=7, column=0) self.turnOffBtn = Button(self, text="Turn Off") self.turnOffBtn["command"] = self.turnOff self.turnOffBtn.grid(row=8, column=0) def turnOn(self): host.enqueue({"SM":"DRIVER_SM", "action":"turnOn", "busId":DRIVERID, "localIP":IP, "localPort":int(PORT)}) def start(self): host.enqueue({"SM":"DRIVER_SM", "action":"start", "route":ROUTNO, "direction":"north", "location":(0,0)}) def turnOff(self): host.enqueue({"SM":"DRIVER_SM", "action":"turnOff"})
class ImageFrame(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.setup() self.initUI() self.schedule() def setup(self): self.capture = cv2.VideoCapture(0) self.key = StringVar() self.val = DoubleVar() 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 schedule(self): def captureImg(): ret, frame = self.capture.read() # Convert the Image object into a TkPhoto object b,g,r = cv2.split(frame) frame = cv2.merge((r,g,b)) im = Image.fromarray(frame) im = im.resize((640, 480),Image.ANTIALIAS) imgtk = ImageTk.PhotoImage(image=im) # Put it in the display window self.imageLabel.configure(image = imgtk) self.imageLabel.image = imgtk self.after(100, captureImg) self.after(100, captureImg)
class MainWindow(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.setupUI() def setupUI(self): self.master.title("Markwhat") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(1, weight=1) self.rowconfigure(1, weight=1) self.markwhat_label = Label(self, text="Markwhat") self.markwhat_label.grid(sticky=W, row=0, column=0) self.markwhat_textarea = WhatText(self, background='white') self.markwhat_textarea.grid(row=1, column=0, sticky=NSEW) self.markwhat_textarea.beenModified = self.on_markwhat_modfified self.markup_label = Label(self, text="Markup") self.markup_label.grid(sticky=W, row=0, column=1) self.markup_preview = HtmlFrame(self) self.markup_preview.grid(row=1, column=1, sticky=NSEW) self.preview_button_text = StringVar() self.preview_button = Button( self, textvariable=self.preview_button_text, command=self.on_preview_click, ) self.preview_button_text.set('HTML') self.preview_button.grid(row=2, column=1, sticky=W) def on_markwhat_modfified(self, event): text = self.markwhat_textarea.get('1.0', END) markup_text = parse_markdown(text) if isinstance(self.markup_preview, HtmlFrame): self.markup_preview.set_content(markup_text) else: self.markup_preview.delete('1.0', END) self.markup_preview.insert('1.0', markup_text) def on_preview_click(self): if isinstance(self.markup_preview, HtmlFrame): self.markup_preview = WhatText(self, background="white") self.preview_button_text.set('HTML') else: self.markup_preview = HtmlFrame(self) self.preview_button_text.set('HTML Source') self.markup_preview.grid(row=1, column=1, sticky=NSEW) self.on_markwhat_modfified(None)
def get_background_of_widget(widget): try: # We assume first tk widget background = widget.cget("background") except: # Otherwise this is a ttk widget style = widget.cget("style") if style == "": # if there is not style configuration option, default style is the same than widget class style = widget.winfo_class() background = Style().lookup(style, 'background') return background
def initUI(self): self.parent.title("Story Creator") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(1, pad=3) self.rowconfigure(2, pad=3) self.rowconfigure(3, pad=3) self.pack()
def initUI(self): self.parent.title("simple") self.i0 = IntVar() self.nvt = IntVar() self.R = IntVar() 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) # i0 self.entryi0 = Entry(self) self.entryi0.grid(row=0, column=1, sticky=W + E) cb = Checkbutton(self, text="i0", variable=self.i0) cb.select() cb.grid(row=1, column=1) cblabel = Label(self, text="use Value?") cblabel.grid(row=2, column=1) # nvt self.entrynvt = Entry(self) self.entrynvt.grid(row=0, column=2, sticky=W + E) cb = Checkbutton(self, text="nVt", variable=self.nvt) cb.select() cb.grid(row=1, column=2) cblabel = Label(self, text="use Value?") cblabel.grid(row=2, column=2) # R self.entryR = Entry(self) self.entryR.grid(row=0, column=3, sticky=W + E) cb = Checkbutton(self, text="R", variable=self.R) cb.select() cb.grid(row=1, column=3) cblabel = Label(self, text="use Value?") cblabel.grid(row=2, column=3) quitbutton = Button(self, text="quit", command=self.parent.destroy) quitbutton.grid(row=8, column=0) refreshbutton = Button(self, text="refresh", command=self.onClick) refreshbutton.grid(row=8, column=4) self.pack()
def initUI(self): self.style = Style().configure("TFrame", background=self.sys.win_cfg.cBackground) self.pack(fill=BOTH, expand=1) self.runTestButton = Button(self, text="Run Test", command=self.runTest, width=20) self.runTestButton.place(x=20, y=20) self.runKoreanButton = Button(self, text="Run Korean", command=self.runKorean, width=20) self.runKoreanButton.place(x=20, y=50)
def __init__(self, image_paths=None, segm_path=None, supervoxel_id_path=None, topframe=None): MyFrame.__init__(self, topframe=None) Style().theme_use('clam') self.set_title('Visualise Volumes') self.set_variables(image_paths, segm_path=segm_path, supervoxel_id_path=supervoxel_id_path) self.create_ui(image_paths=image_paths, supervoxel_id_path=supervoxel_id_path)
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) Style().configure("TFrame", background="#333") # bard = Image.open('image1.jpg') # bardejov = ImageTk.PhotoImage(bard) label1 = Label(self, text="label1") # label.image = bardejov label1.place(x=20, y=20) # # rot = Image.open("image2.jpg") # rotunda = ImageTk.PhotoImage(rot) label2 = Label(self, text="label2") # label2.image = rotunda label2.place(x=40, y=160)
def initUI(self): self.parent.title("Catalog Analyzer") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') 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) ## ENTRY ### band1Label = Label(self, text='Band 1') band1Label.grid(row=0, column=0) band1Entry = Entry(self) band1Entry.grid(row=0, column=1) band2Label = Label(self, text='Band 2') band2Label.grid(row=0, column=2) band2Entry = Entry(self) band2Entry.grid(row=0, column=3 ) band3Label = Label(self, text='Band 3') band3Label.grid(row=1, column=0) band3Entry = Entry(self) band3Entry.grid(row=1, column=1) band4Label = Label(self, text='Band 4') band4Label.grid(row=1, column=2) band4Entry = Entry(self) band4Entry.grid(row=1, column=3 ) ## BUTTONS ### sizeMagButton = Button(self, text ="Size Magnitude", command = sizeMag) sizeMagButton.grid(row=2 , column = 0) hrButton = Button(self, text ="H-R Diagram", command = HR) hrButton.grid(row=2 , column = 1) colorColorButton = Button(self, text='Color Color', command=colorColor) colorColorButton.grid(row=2 , column = 2) self.pack()
def initUI(self): self.style = Style().configure("TFrame", background=self.sys.win_cfg.cBackground) self.pack(fill=BOTH, expand=1) # setup labels self.Vacuum = Label(self, width=16, background=self.sys.win_cfg.cLEDOff, text="Idle") self.Vacuum.place(x=20, y=10) #duty cycle # setup buttons vacuumButton = Button(self, text="Toggle Vacuum", command=self.vacuum_toggle, width=15) vacuumButton.place(x=30, y=40) valveutton = Button(self, text="Toggle Valve", command=self.valve_toggle, width=15) valveutton.place(x=30, y=70) pressureButton = Button(self, text="Measure Pressure", command=self.measure_pressure, width=15) pressureButton.place(x=30, y=100) self.statusLabel = Label(self, width=15, background=self.sys.win_cfg.cBackground, text="") self.statusLabel.place(x=15, y=130) # close buttons closeButton = Button(self, text="Close", command=self.close_window, width=15) closeButton.place(x=30, y=160)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) self.controller = controller Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(5, pad=5) ''''' self.columnconfigure(1, pad=5) self.columnconfigure(2, pad=5) self.columnconfigure(3, pad=5) self.columnconfigure(4, pad=5) self.rowconfigure(0, pad=15) self.rowconfigure(1, pad=15) self.rowconfigure(2, pad=15) self.rowconfigure(3, pad=15) self.rowconfigure(4, pad=15) self.rowconfigure(18, pad=15) self.rowconfigure(46, pad=15)"""""" ''' imagehead = Image.open("ucs.png") tkimage = ImageTk.PhotoImage(imagehead) self.tkimage = tkimage panel1 = Label(self, image=tkimage, width=600, height=500) panel1.grid(row=10, column=0, sticky=E) # for two big textboxes self.tb8 = Text(self, width=55, height=8, font=("Helvetica", 11), wrap=WORD) self.tb8.grid(row=10, column=20, columnspan=2, sticky=W) # forsmall two textboxes self.tb1 = Text(self, width=30, height=5) self.tb1.grid(row=0, column=0, sticky=W) self.tb1.insert(0.0, "insert start state") self.tb2 = Text(self, width=30, height=5) self.tb2.insert(0.0, "insert goal state") self.tb2.grid(row=0, column=1, sticky=W) # buttons self.hbtn = Button(self, text="BACK", command=lambda: controller.show_frame("StartPage")) self.hbtn.grid(row=1, column=0, columnspan=2, sticky=W) self.obtn = Button(self, text="SUBMIT", command=lambda: self.info()) self.obtn.grid(row=1, column=1, columnspan=2, sticky=W)
def initUI(self): # os.system('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp') # os.environ['CUDA_VISIBLE_DEVICES'] = str(np.argmax([int(x.split()[2]) for x in open('tmp', 'r').readlines()])) # os.system('rm tmp') os.environ["CUDA_VISIBLE_DEVICES"] = '0' sess = tf.Session() self.usrId = time.time() self.usrId = int(time.time() - 1495000000) if not os.path.isdir("res/%d" % self.usrId): os.makedirs("res/%d" % self.usrId) os.makedirs("res/%d/Ours" % self.usrId) self.parent.title("Interactive Image Segmentation") self.pack(fill=BOTH, expand=1) global T T = Text(self, height=100, width=20) T.pack() T.insert(END, "Welcome!\n") T.place(x=1760, y=20) Style().configure("TFrame", background="#333") w = 1920 h = 1080 # w = 1280 # h = 900 sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() x = (sw - w) / 2 y = (sh - h) / 2 self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y)) self.filename = tkFileDialog.askopenfilename( initialdir="./", title="Select file", filetypes=(("jpeg files", "*.jpg"), ("all files", "*.*"))) self.update_all() self.bind_all("<Button-1>", self.callback_left) self.bind_all("<Button-3>", self.callback_right)
def initUI(self): self.actions = self.parent.link.getIDs( ) #load here (load the hash list from sls.py) NOT LOADING FROM SLS BUT MATHGRAPH self.index.set("") Style().configure("TButton", padding=(0, 5, 0, 5), background='WhiteSmoke') if len(self.actions) > 0: self.empty = False else: self.actions.append("") if self.empty: start = Button(self, text="Start New", command=self.changeFrame) start.grid(row=1, column=1) actOM = OptionMenu(self, self.index, *self.actions, command=self.enter) actOM.config(width=5) actOM.grid(row=1, column=0, sticky="ew")
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) Style().configure("TFrame", background="#333") bard = Image.open("FB_IMG_1480585320571.jpg") bard = bard.resize((250, 250), Image.ANTIALIAS) bardejov = ImageTk.PhotoImage(bard) label1 = Label(self, image=bardejov) label1.image = bardejov label1.place(x=20, y=20) rot = Image.open("IMG_20141026_164122275_4.jpg") rot = rot.resize((250, 250), Image.ANTIALIAS) rotunda = ImageTk.PhotoImage(rot) label2 = Label(self, image=rotunda) label2.image = rotunda label2.place(x=20, y=290)
def __initUi(self): self.master.title('GPIO Test') 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=235, height=100) self.status_frame.place(x=20, y=20) self.path_frame_1 = LabelFrame(self, text='GPIO Pin (between 0 and 27)', relief=RIDGE, height=60, width=235) self.path_frame_1.place(x=20, y=150) self.entry_1 = Entry(self.path_frame_1, bd=5, textvariable=self.gpioPin) self.entry_1.place(x=20, y=5) self.entry_1.focus_set() # TEST RESULTS LABEL w = Label(self.status_frame, textvariable=self.results) w.place(x=50, y=50) # Toggle Button self.toggleButton = Button(self, text="Toggle", command=self.toggle, height=4, width=20, background='green') self.toggleButton.place(x=20, y=250) self.toggleButton.bind('<Return>', lambda e: self.hi()) self.isHi = False gpio_ns_init()
def initUI(self): self.parent.title("Persona Creator") self.grid(row=0, column=0) Style().configure("TButton", padding=(0, 5, 0, 5), background='WhiteSmoke') nameL = Label(self, text="Name:") nameL.grid(row=1, column=1) self.nameT = Text(self, height=1, width=25) self.nameT.grid(row=1, column=2) self.importantB = Checkbutton(self, text="Important?", variable=self.var) self.importantB.grid(row=1, column=3) infoL = Label(self, text="Info:") infoL.grid(row=2, column=1) self.infoT = Text(self, height=7, width=50, wrap=WORD) self.infoT.grid(row=2, column=2, columnspan=2) save = Button(self, text="Save", command=self.save) save.grid(row=4, column=1) edit = Button(self, text="Remove", command=self.remove) edit.grid(row=4, column=2) back = Button(self, text="Back", command=self.back) back.grid(row=4, column=3) names = json_reader.readCharNames() names.append("New") self.variable.set("New") # default value if len(names) == 1: w = OptionMenu(self, self.variable, "New", command=self.loadChar) else: w = OptionMenu(self, self.variable, *names, command=self.loadChar) w.grid(row=4, column=4)
def initUI(self): animations = json_reader.data_list("animations") characs = json_reader.readCharNames() self.aniv.set("Idle") Style().configure("TButton", padding=(0, 5, 0, 5), background='WhiteSmoke') self.textl = Label(self, text="Go to x:") self.textl.grid(row=1, column=0) self.lx = Text(self, height=1, width=3) self.lx.grid(row=1, column=1) self.textl = Label(self, text="Go to y:") self.textl.grid(row=2, column=0) self.ly = Text(self, height=1, width=3) self.ly.grid(row=2, column=1) self.speakerl = Label(self, text="Person:") self.speakerl.grid(row=1, column=3) speaker = OptionMenu(self, self.speakerv, *characs) speaker.config(width=10) speaker.grid(row=1, column=4, sticky='ew') self.anil = Label(self, text="Animation:") self.anil.grid(row=2, column=3) ani = OptionMenu(self, self.aniv, *animations) ani.config(width=10) ani.grid(row=2, column=4, sticky='ew') if self.load != 0: try: self.aniv.set(self.load.getAnimation()) self.speakerv.set(self.load.getSubject()) self.lx.insert(1.0, self.load.getDestination()[0]) self.ly.insert(1.0, self.load.getDestination()[1]) except: pass
def initUI(self, infoDump): self.parent.title("Persona Creator") self.grid(row=0, column=0) Style().configure("TButton", padding=(0, 5, 0, 5), background='WhiteSmoke') if (infoDump): self.infoFrameDraw() else: self.createFrameDraw() self.initButtonFrame(infoDump) self.listP = Listbox(self) self.listP.grid(row=0, column=3, columnspan=2, rowspan=3) temp = json_reader.readPerNames() for name in temp: self.listP.insert(END, name)
def test(): tkroot = Tk() s = Style() s.configure('Title.TLabel', font="ariel 20 bold") s.configure('TButton', font="ariel 14 bold") tkroot.option_add("*TButton.Font", "ariel 12 bold") tkroot.option_add("*Label.Font", "Helvetica 10") fail_str = "LogFinalTestStatus RT_Final='FAIL'\n+++OUT OF RANGE+++ F1_TX0_IQOffset == -16.2532762607\n+++OUT OF RANGE+++ F1_TX1_PwrDac == 28\n+++OUT OF RANGE+++ F1_TX1_DataEvm == -31.6506357937\n+++OUT OF RANGE+++ F1_TX1_IQOffset == -2.30501317739\n+++OUT OF RANGE+++ F2_TX0_IQOffset == -15.214029339\n+++OUT OF RANGE+++ F2_TX1_DataEvm == -30.5567960708\n+++OUT OF RANGE+++ F2_TX1_IQOffset == -12.6593769606" StatusWindow(tkroot, "Test Status -- 00:27:22:DA:00:01", "PASS\n".rstrip()) StatusWindow(tkroot, "Test Status -- 00:27:22:DA:00:01", "FAIL\n".rstrip(), fail_str)
def initUI(self): self.parent.title("Captura de datos") self.style = Style() self.pack(fill=BOTH, expand=1) BotonIncX = Button(self, text="+", command=IncX) BotonIncX.place(x=300, y=150) label1 = Label(self, text="Incrementar X:") label1.place(x=150, y=150) global texto1, texto2, x, y x = 0 y = 0 texto1 = StringVar() texto1.set(x) label10 = Label(self, textvariable=texto1, width=5, relief="solid") label10.place(x=250, y=175) BotonDecX = Button(self, text="-", command=DecX) BotonDecX.place(x=300, y=200) label2 = Label(self, text="Decrementar X:") label2.place(x=150, y=200) BotonIncY = Button(self, text="+", command=IncY) BotonIncY.place(x=300, y=250) label3 = Label(self, text="Incrementar Y:") label3.place(x=150, y=250) texto2 = StringVar() texto2.set(y) label101 = Label(self, textvariable=texto2, width=5, relief="solid") label101.place(x=250, y=275) BotonDecY = Button(self, text="-", command=DecY) BotonDecY.place(x=300, y=300) label4 = Label(self, text="Decrementar Y:") label4.place(x=150, y=300) Grabar = Button(self, text="Grabar Registro", command=GrabarRegistro) Grabar.place(x=150, y=340) global ListaMACs ListaMACs = Listbox(self, bd=2, relief="solid", height=4, width=82) ListaMACs.place(x=50, y=50) Scan = Button(self, text="Escanear RSSI en MAC", command=ScanMAC) Scan.place(x=350, y=340)
def layout_gui(self): master = self.master s = Style() s.theme_use('default') s.configure('TProgressbar', thickness=50) helv36 = tkFont.Font(family='Helvetica', size=36, weight='bold') b = Button(master, text="Quit", command=self.quit, width=10, height=2) b['font'] = helv36 b.grid(row=0, column=0) pb = Progressbar(master, orient=VERTICAL, length=100, mode='determinate', style='TProgressbar') pb['value'] = 50 pb.grid(row=0, column=1)
def initUI(self): Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') for i in range(5): self.rowconfigure(i, pad=9) if i<4: self.columnconfigure(i, pad=3) matrix = { 'Cls': [1, 0], 'Back': [1, 1], 'Close': [1, 3], '7': [2, 0], '8': [2, 1], '9': [2, 2], '/': [2, 3], '4': [3, 0], '5': [3, 1], '6': [3, 2], '*': [3, 3], '1': [4, 0], '2': [4, 1], '3': [4, 2], '-': [4, 3], '0': [5, 0], '.': [5, 1], '=': [5, 2], '+': [5, 3], } entry = Entry(self) entry.grid(row=0, columnspan=4, sticky=W+E) for k, v in matrix.items(): v.append(Button(self, text=k)) v[2].grid(row=v[0], column=v[1]) self.matrix = matrix self.pack(padx=5, pady=5)
def initUI(self): self.parent.title("RPI Motors") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') # configure grid self.columnconfigure(0, pad=5) self.columnconfigure(1, pad=5) self.columnconfigure(2, pad=5) self.rowconfigure(0, pad=5) self.rowconfigure(1, pad=5) self.rowconfigure(2, pad=5) # label self.port_lbl = Label(self, text="Port") self.port_lbl.grid(row=0, column=0, pady=4, padx=5, sticky=W + E) # input text self.entry = Entry(self, ) self.entry.grid(row=0, column=1, columnspan=3, sticky=W + E) # control buttons self.cls = Button(self, text="Turn Left", command=self.motor.turn_left()) self.cls.grid(row=1, column=0, sticky=E + W) self.bck = Button(self, text="Stop", command=self.motor.stop_mov()) self.bck.grid(row=1, column=1, sticky=E + W) self.lbl = Button(self, text="Turn Right", command=self.motor.turn_right()) self.lbl.grid(row=1, column=2, sticky=E + W) # exit button self.clo = Button(self, text="Exit", command=self.quit) self.clo.grid(row=2, columnspan=4, sticky=E + W) # draw self.pack()
def initUI(self): self.parent.title("Social Link Creator") self.grid(row=0, column=0) Style().configure("TButton", padding=(0, 5, 0, 5), background='WhiteSmoke') list = json_reader.data_list("arcanas") self.variable.set("Select Arcana") w = OptionMenu(self, self.variable, *list, command=self.showText) w.grid(row=0, column=1) select = Button(self, text="Select", command=self.context) select.grid(row=1, column=1) back = Button(self, text="Back", command=self.back) back.grid(row=2, column=1) self.v.set("") self.text = Label(self, textvariable=self.v, wraplength=500) self.text.grid(row=0, column=0, rowspan=3)
def initUI(self): self.style = Style().configure("TFrame", background=self.sys.win_cfg.cBackground) self.pack(fill=BOTH, expand=1) # setup labels self.LED1 = Label(self, width=10, background=self.sys.win_cfg.cLEDOff, text="LED1") self.LED1.place(x=30, y=10) #duty cycle # setup buttons ledonButton = Button(self, text="LED On", command=self.led_on) ledonButton.place(x=30, y=40) ledoffButton = Button(self, text="LED Off", command=self.led_off) ledoffButton.place(x=30, y=70) serialButton = Button(self, text="Serial", command=self.led_serial_status) serialButton.place(x=30, y=100) #ledstatusButton = Button(self, text="Status", # command=self.led_status) #ledstatusButton.place(x=30, y=130) ledAdvButton = Button(self, text="Advanced", command=self.led_advanced) ledAdvButton.place(x=30, y=130) self.ledstatusLabel = Label(self, width=15, background=self.sys.win_cfg.cBackground, text="LED: Status: X") self.ledstatusLabel.place(x=15, y=158) # close buttons closeButton = Button(self, text="Close", command=self.close_window) closeButton.place(x=30, y=180)
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.sFocus, background=self.sys.win_cfg.cBackground, width=12, height=1) titleLabel.place(x=5, y=5) # file function buttons coarseFocusButton = Button(self, text="Coarse", command=self.coarse_focus, width=17) coarseFocusButton.place(x=15, y=40) fineFocusButton = Button(self, text="Fine", command=self.fine_focus, width=17) fineFocusButton.place(x=15, y=80) halfButton = Button(self, text="Center Corner", command=self.center_corner, width=17) halfButton.place(x=15, y=120) # close buttons closeButton = Button(self, text="Close", command=self.close_window, width=17) closeButton.place(x=15, y=160)
def initUI(self): self.parent.title("Absolute positioning") self.pack(fill=BOTH, expand=1) Style().configure("TFrame", background="#333") bard = Image.open("bardejov.jpg") bardejov = ImageTk.PhotoImage(bard) label1 = Label(self, image=bardejov) label1.image = bardejov label1.place(x=20, y=20) rot = Image.open("rotunda.jpg") rotunda = ImageTk.PhotoImage(rot) label2 = Label(self, image=rotunda) label2.image = rotunda label2.place(x=40, y=160) minc = Image.open("mincol.jpg") mincol = ImageTk.PhotoImage(minc) label3 = Label(self, image=mincol) label3.image = mincol label3.place(x=170, y=50)
def initUI(self): Style().configure("TButton",padding=15,width=8,font="serif 10") self.screen_var = StringVar() self.result_str= " " self.result = Label(self, textvariable = self.screen_var) self.result.pack() self.cls = Button(text="Cls",command=self.clsfun) self.back = Button(text="Back",command =self.backfun) self.empty = Button(text="Empty") self.close = Button(text="Close",command=self.closefun) self.but7=Button(text="7",command = self.but7fun) self.but8 = Button(text="8",command=self.but8fun) self.but9 = Button(text="9",command=self.but8fun) self.divide = Button(text="/",command= self.dividefun) self.but4 = Button(text="4",command=self.but4fun) self.but5 = Button(text="5",command=self.but5fun) self.but6 = Button(text="6",command=self.but6fun) self.multiply = Button(text="*",command=self.multiplyfun) self.but1 = Button(text="1",command=self.but1fun) self.but2 = Button(text="2",command=self.but2fun) self.but3 = Button(text="3",command=self.but3fun) self.sub = Button(text="-",command=self.subfun) self.but0 = Button(text="0",command=self.but0fun) self.dot = Button(text=".") self.equal = Button(text="=",command=self.equalfun) self.sum = Button(text="+",command=self.sumfun) self.packUI()
def createWidgets(self, master): #-Set-progress-bar-style-for-custom-thickness-- s = Style() s.theme_use("default") s.configure("TProgressbar", thickness=5) #---------------------------------------------- master.grid_rowconfigure(0, weight=1) master.grid_columnconfigure(0, weight=1) # +++++++++++++++++++++++++++++++ row = 0 col = 0 w = LabelFrame(master, text='Sample positioner status') w.grid(row=row, column=col, sticky=NSEW, padx=5, pady=5) self.populateDisplayPanel(w)
def func(self): self.pack(fill=BOTH, expand=1) Style().configure("TFrame", background="#333") bard = Image.open("FB_IMG_1480585320571.jpg") bard = bard.resize((250, 250), Image.ANTIALIAS) bardejov = ImageTk.PhotoImage(bard) label1 = Label(self, image=bardejov) label1.image = bardejov label1.place(x=20, y=20) rot = Image.open("IMG_20141026_164122275_4.jpg") rot = rot.resize((250, 250), Image.ANTIALIAS) rotunda = ImageTk.PhotoImage(rot) label2 = Label(self, image=rotunda) label2.image = rotunda label2.place(x=20, y=290) rot1 = Image.open("Apurv.jpg") rot1 = rot1.resize((250, 250), Image.ANTIALIAS) rotunda1 = ImageTk.PhotoImage(rot1) label3 = Label(self, image=rotunda1) label3.image = rotunda1 label3.place(x=300, y=20)
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=225) self.path_frame.place(x=400, y=550) entry = Entry(self.path_frame, bd=5, textvariable=self.serial_num) 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)