Python ttk.Label() Examples
The following are 30
code examples of ttk.Label().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ttk
, or try the search function
.
Example #1
Source File: annotation_gui.py From SEM with MIT License | 9 votes |
def preferences(self, event=None): preferenceTop = tkinter.Toplevel() preferenceTop.focus_set() notebook = ttk.Notebook(preferenceTop) frame1 = ttk.Frame(notebook) notebook.add(frame1, text='general') frame2 = ttk.Frame(notebook) notebook.add(frame2, text='shortcuts') c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word) c.pack() shortcuts_vars = [] shortcuts_gui = [] cur_row = 0 j = -1 frame_list = [] frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts")) frame_list[-1].pack(fill="both", expand="yes") for i, shortcut in enumerate(self.shortcuts): j += 1 key, cmd, bindings = shortcut name, command = cmd shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key)) tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W) entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j]) entry.grid(row=cur_row, column=1) cur_row += 1 notebook.pack() # # ? menu methods #
Example #2
Source File: components.py From SEM with MIT License | 8 votes |
def __init__(self, root, resource_dir): ttk.Frame.__init__(self, root) self.master_selector = None self.resource_dir = resource_dir self.items = os.listdir(os.path.join(self.resource_dir, "master")) self.cur_lang = tkinter.StringVar() self.select_lang_label = ttk.Label(root, text=u"select language:") self.langs = ttk.Combobox(root, textvariable=self.cur_lang) self.langs["values"] = self.items self.langs.current(0) for i, item in enumerate(self.items): if item == "fr": self.langs.current(i) self.langs.bind("<<ComboboxSelected>>", self.select_lang)
Example #3
Source File: test_tooltip.py From tkcalendar with GNU General Public License v3.0 | 6 votes |
def test_tooltip(self): t = Tooltip(self.window, text='Hi!', style='my.TLabel', alpha=0.5) self.window.update() self.assertEqual(t.keys(), ['alpha'] + ttk.Label().keys()) self.assertEqual(str(t.cget('compound')), 'left') self.assertEqual(t.cget('text'), 'Hi!') self.assertEqual(t.cget('alpha'), 0.5) self.assertEqual(t.cget('style'), 'my.TLabel') t.configure(text='Hello', style='test.TLabel', image=None, alpha=0.75, compound='right') self.assertEqual(str(t.cget('compound')), 'right') self.assertEqual(t.cget('text'), 'Hello') self.assertEqual(t.cget('alpha'), 0.75) self.assertEqual(t.cget('style'), 'test.TLabel') self.assertEqual(t.cget('image'), '')
Example #4
Source File: test_widgets.py From BinderFilter with MIT License | 6 votes |
def test_sashpos(self): self.assertRaises(Tkinter.TclError, self.paned.sashpos, None) self.assertRaises(Tkinter.TclError, self.paned.sashpos, '') self.assertRaises(Tkinter.TclError, self.paned.sashpos, 0) child = ttk.Label(self.paned, text='a') self.paned.add(child, weight=1) self.assertRaises(Tkinter.TclError, self.paned.sashpos, 0) child2 = ttk.Label(self.paned, text='b') self.paned.add(child2) self.assertRaises(Tkinter.TclError, self.paned.sashpos, 1) self.paned.pack(expand=True, fill='both') self.paned.wait_visibility() curr_pos = self.paned.sashpos(0) self.paned.sashpos(0, 1000) self.assertTrue(curr_pos != self.paned.sashpos(0)) self.assertTrue(isinstance(self.paned.sashpos(0), int))
Example #5
Source File: seqlib_apply_dialog.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
def body(self, master): """ Generates the required text listing all SeqLibs that will have their FASTQ options updated. Displays the "OK" and "Cancel" buttons. """ if len(self.target_ids) == 0: message_string = "No elegible SeqLibs selected." elif len(self.target_ids) == 1: message_string = 'Apply FASTQ filtering options from "{}" to "{}"?'.format( self.tree.get_element(self.source_id).name, self.tree.get_element(self.target_ids[0]).name, ) else: bullet = " " + u"\u25C6" message_string = 'Apply FASTQ filtering options from "{}"" to the following?\n'.format( self.tree.get_element(self.source_id).name ) for x in self.target_ids: message_string += u"{bullet} {name}\n".format( bullet=bullet, name=self.tree.get_element(x).name ) message = ttk.Label(master, text=message_string, justify="left") message.grid(row=0, sticky="w")
Example #6
Source File: test_widgets.py From oss-ftp with MIT License | 6 votes |
def test_sashpos(self): self.assertRaises(tkinter.TclError, self.paned.sashpos, None) self.assertRaises(tkinter.TclError, self.paned.sashpos, '') self.assertRaises(tkinter.TclError, self.paned.sashpos, 0) child = ttk.Label(self.paned, text='a') self.paned.add(child, weight=1) self.assertRaises(tkinter.TclError, self.paned.sashpos, 0) child2 = ttk.Label(self.paned, text='b') self.paned.add(child2) self.assertRaises(tkinter.TclError, self.paned.sashpos, 1) self.paned.pack(expand=True, fill='both') self.paned.wait_visibility() curr_pos = self.paned.sashpos(0) self.paned.sashpos(0, 1000) self.assertNotEqual(curr_pos, self.paned.sashpos(0)) self.assertIsInstance(self.paned.sashpos(0), int)
Example #7
Source File: components.py From SEM with MIT License | 6 votes |
def __init__(self, root, main_window, button_opt): ttk.Frame.__init__(self, root) self.root = root self.main_window = main_window self.current_files = None self.button_opt = button_opt # define options for opening or saving a file self.file_opt = options = {} options['defaultextension'] = '.txt' options['filetypes'] = [('all files', '.*'), ('text files', '.txt')] options['initialdir'] = os.path.expanduser("~") options['parent'] = root options['title'] = 'Select files to annotate.' self.file_selector_button = ttk.Button(self.root, text=u"select file(s)", command=self.filenames) self.label = ttk.Label(self.root, text=u"selected file(s):") self.fa_search = tkinter.PhotoImage(file=os.path.join(self.main_window.resource_dir, "images", "fa_search_24_24.gif")) self.file_selector_button.config(image=self.fa_search, compound=tkinter.LEFT) self.scrollbar = ttk.Scrollbar(self.root) self.selected_files = tkinter.Listbox(self.root, yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.selected_files.yview)
Example #8
Source File: Tkinter_Widget_Examples.py From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License | 6 votes |
def __init__(self, master): tk.Frame.__init__(self, master) self.pack(padx=20, pady=20) self.master = master self.selection = tk.StringVar() self.selection.set('white') tk.Label(self, text="These are radiobuttons").pack() tk.Radiobutton(self, text='White', value='white', variable=self.selection, command=self.set_color).pack(anchor='w') tk.Radiobutton(self, text='Red', value='red', variable=self.selection, command=self.set_color).pack(anchor='w') tk.Radiobutton(self, text='Green', value='green', variable=self.selection, command=self.set_color).pack(anchor='w') tk.Radiobutton(self, text='Blue', value='blue', variable=self.selection, command=self.set_color).pack(anchor='w')
Example #9
Source File: Tkinter_Widget_Examples.py From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License | 6 votes |
def __init__(self, master): ttk.Frame.__init__(self, master) self.pack() ttk.Label(self, text="This is an 'indeterminate' progress bar").pack(padx=20, pady=10) progress1 = ttk.Progressbar(self, orient='horizontal', length=500, mode='indeterminate') progress1.pack(padx=20, pady=10) ttk.Label(self, text="This is a 'determinate' progress bar").pack(padx=20, pady=10) progress2 = ttk.Progressbar(self, orient='horizontal', length=500, mode='determinate') progress2.pack(padx=20, pady=10) progress1.start() progress2.start()
Example #10
Source File: PluginOptions.py From aurora-sdk-mac with Apache License 2.0 | 6 votes |
def toggle_empty_state(self, show, addRow=True): if (show): self.root.minsize(width=0, height=260) self.root.maxsize(width=1200, height=260) self.emptyStateButton = ttk.Button(self.mainPluginFrame, text="Add Plugin Options", command=lambda: self.toggle_empty_state(False)) self.emptyStateButton.grid(column=0, row=0, sticky=(N,W,E,S)) if self.showingHeader: self.headerLabel.destroy() self.addButton.destroy() self.generateButton.destroy() else: self.root.minsize(width=0, height=380) self.root.maxsize(width=1200, height=380) self.showingHeader = True self.headerLabel = ttk.Label(self.mainPluginFrame, text="Plugin Options") self.headerLabel.grid(column=0, row=0, sticky=(N,W), pady=(0, 15)) self.addButton = ttk.Button(self.mainPluginFrame, text='Add Plugin Option', command=self.add_plugin_option) self.addButton.grid(column=1, row=0, sticky=(N,E)) self.generateButton = ttk.Button(self.mainPluginFrame, text='Generate Header', command=self.generate_plugin_options_header) self.generateButton.grid(column=2, row=0, sticky=(N,E)) if self.emptyStateButton: if addRow: self.add_plugin_option() self.emptyStateButton.destroy()
Example #11
Source File: delete_dialog.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
def body(self, master): """ Generates the required text listing all elements that will be deleted. Displays the "OK" and "Cancel" buttons. """ if len(self.id_tuples) == 0: message_string = "No elements selected." elif len(self.id_tuples) == 1: message_string = 'Delete "{}"?'.format( self.tree.get_element(self.id_tuples[0][0]).name ) else: message_string = "Delete the following items?\n" for x, level in self.id_tuples: if level == 0: bullet = " " + u"\u25C6" else: bullet = " " * (level + 1) + u"\u25C7" message_string += u"{bullet} {name}\n".format( bullet=bullet, name=self.tree.get_element(x).name ) message = ttk.Label(master, text=message_string, justify="left") message.grid(row=0, sticky="w")
Example #12
Source File: tkinter_gui.py From ChatterBot with BSD 3-Clause "New" or "Revised" License | 6 votes |
def initialize(self): """ Set window layout. """ self.grid() self.respond = ttk.Button(self, text='Get Response', command=self.get_response) self.respond.grid(column=0, row=0, sticky='nesw', padx=3, pady=3) self.usr_input = ttk.Entry(self, state='normal') self.usr_input.grid(column=1, row=0, sticky='nesw', padx=3, pady=3) self.conversation_lbl = ttk.Label(self, anchor=tk.E, text='Conversation:') self.conversation_lbl.grid(column=0, row=1, sticky='nesw', padx=3, pady=3) self.conversation = ScrolledText.ScrolledText(self, state='disabled') self.conversation.grid(column=0, row=2, columnspan=2, sticky='nesw', padx=3, pady=3)
Example #13
Source File: gui.py From stochopy with MIT License | 6 votes |
def de_widget(self): # Initialize widget self.init_widget() # strategy self.strategy_label = ttk.Label(self.frame1.sliders, text = "Strategy") self.strategy_option_menu = ttk.OptionMenu(self.frame1.sliders, self.strategy, self.strategy.get(), *sorted(self.STRATOPT)) self.strategy_label.place(relx = 0, x = 0, y = 5, anchor = "nw") self.strategy_option_menu.place(relx = 0, x = 70, y = 3, anchor = "nw") # CR self._label("Crossover probability", 2) self._scale(0., 1., 0.01, self.CR, 2) self._entry(self.CR, 2) # F self._label("Differential weight", 4) self._scale(0., 2., 0.01, self.F, 4) self._entry(self.F, 4)
Example #14
Source File: date_decoder.py From Learning-Python-for-Forensics-Second-Edition with MIT License | 5 votes |
def build_input_frame(self): """ The build_input_frame method builds the interface for the input frame """ # Frame Init self.input_frame = ttk.Frame(self.root) self.input_frame.config(padding = (30,0)) self.input_frame.pack() # Input Value ttk.Label(self.input_frame, text="Enter Time Value").grid(row=0, column=0) self.input_time = StringVar() ttk.Entry(self.input_frame, textvariable=self.input_time, width=25).grid(row=0, column=1, padx=5) # Radiobuttons self.time_type = StringVar() self.time_type.set('raw') ttk.Radiobutton(self.input_frame, text="Raw Value", variable=self.time_type, value="raw").grid(row=1, column=0, padx=5) ttk.Radiobutton(self.input_frame, text="Formatted Value", variable=self.time_type, value="formatted").grid( row=1, column=1, padx=5) # Button ttk.Button(self.input_frame, text="Run", command=self.convert).grid( row=2, columnspan=2, pady=5)
Example #15
Source File: brutexss.py From BruteXSS with GNU General Public License v3.0 | 5 votes |
def checkupdates(): def errorbox(): error = Tk() error.geometry("268x82+482+242") error.title("Error!") error.configure(background="#d9d9d9") if os.name == 'nt': error.iconbitmap('icon.ico') else: pass Label1 = Label(error) Label1.place(relx=0.04, rely=0.24, height=21, width=244) Label1.configure(background="#d9d9d9") Label1.configure(disabledforeground="#a3a3a3") Label1.configure(foreground="#000000") Label1.configure(text='''Oops! I think you''') Label1.configure(width=244) Label2 = Label(error) Label2.place(relx=0.07, rely=0.49, height=21, width=230) Label2.configure(background="#d9d9d9") Label2.configure(disabledforeground="#a3a3a3") Label2.configure(foreground="#000000") Label2.configure(text='''don't have a working internet connection !''') error.mainloop() try: versionfile = urllib2.urlopen('https://raw.githubusercontent.com/rajeshmajumdar/BruteXSS/master/version.txt').read() if float(versionfile) > float(__version__): updatefunc() else: print 'Nothing happened' start() except Exception as e: errorbox()
Example #16
Source File: Tkinter_Widget_Examples.py From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License | 5 votes |
def __init__(self, master): ttk.Frame.__init__(self, master) self.pack() options = ['Minneapolis', 'Eau Claire', 'Cupertino', 'New York', 'Amsterdam', 'Sydney', 'Hong Kong'] ttk.Label(self, text="This is a combobox").pack(pady=10) self.combo = ttk.Combobox(self, values=options, state='readonly') self.combo.current(0) self.combo.pack(padx=15) ttk.Button(self, text='OK', command=self.ok).pack(side='right', padx=15, pady=10)
Example #17
Source File: sqlite_bro.py From sqlite_bro with MIT License | 5 votes |
def createToolTip(self, widget, text): """create a tooptip box for a widget.""" # www.daniweb.com/software-development/python/code/234888/tooltip-box def enter(event): global tipwindow x = y = 0 try: tipwindow = tipwindow except: tipwindow = None if tipwindow or not text: return x, y, cx, cy = widget.bbox("insert") x += widget.winfo_rootx() + 27 y += widget.winfo_rooty() + 27 # Creates a toplevel window tipwindow = tw = Toplevel(widget) # Leaves only the label and removes the app window tw.wm_overrideredirect(1) tw.wm_geometry("+%d+%d" % (x, y)) label = Label(tw, text=text, justify=LEFT, background="#ffffe0", relief=SOLID, borderwidth=1) label.pack(ipadx=1) def close(event): global tipwindow tw = tipwindow tipwindow = None if tw: tw.destroy() widget.bind("<Enter>", enter) widget.bind("<Leave>", close)
Example #18
Source File: marmot.py From aggregation with Apache License 2.0 | 5 votes |
def __run__(self): # create the welcome window run_type = None t = tkinter.Toplevel(self.root) t.resizable(False,False) frame = ttk.Frame(t, padding="3 3 12 12") frame.grid(column=0, row=0, sticky=(tkinter.N, tkinter.W, tkinter.E, tkinter.S)) frame.columnconfigure(0, weight=1) frame.rowconfigure(0, weight=1) ttk.Label(frame,text="Welcome to Marmot.").grid(column=1,row=1) def setup(require_gold_standard): # this will determine the whole run mode from here on in self.require_gold_standard = require_gold_standard self.subjects = self.__image_select__(require_gold_standard) # if r == "a": # self.subjects = self.project.__get_retired_subjects__(1,True) # self.run_mode = "a" # else: # # when we want to explore subjects which don't have gold standard # # basically creating some as we go # # False => read in all subjects, not just those with gold standard annotations # # todo - takes a while in read in all subjects. Better way? # self.subjects = self.project.__get_retired_subjects__(1,False) # self.run_mode = "b" random.shuffle(self.subjects) self.__thumbnail_display__() self.__add_buttons__() t.destroy() ttk.Button(frame, text="Explore results using existing expert annotations", command = lambda : setup(True)).grid(column=1, row=2) ttk.Button(frame, text="Explore and create gold standard on the fly", command = lambda : setup(False)).grid(column=1, row=3) t.lift(self.root) # self.outputButtons() self.root.mainloop()
Example #19
Source File: date_decoder.py From Learning-Python-for-Forensics-Second-Edition with MIT License | 5 votes |
def build_output_frame(self): """ The build_output_frame method builds the interface for the output frame """ # Output Frame Init self.output_frame = ttk.Frame(self.root) self.output_frame.config(height=300, width=500) self.output_frame.pack() # Output Area ## Label for area self.output_label = ttk.Label(self.output_frame, text="Conversion Results") self.output_label.config(font=("", 16)) self.output_label.pack(fill=X) ## For Unix Seconds Timestamps self.unix_sec = ttk.Label(self.output_frame, text="Unix Seconds: N/A") self.unix_sec.pack(fill=X) ## For Windows FILETIME 64 Timestamps self.win_ft_64 = ttk.Label(self.output_frame, text="Windows FILETIME 64: N/A") self.win_ft_64.pack(fill=X) ## For Chrome Timestamps self.google_chrome = ttk.Label(self.output_frame, text="Google Chrome: N/A") self.google_chrome.pack(fill=X)
Example #20
Source File: Tkinter_Widget_Examples.py From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License | 5 votes |
def __init__(self, master): tk.Frame.__init__(self, master) self.pack(padx=20, pady=20) self.master = master options = ['white', 'red', 'green', 'blue'] self.selection = tk.StringVar() self.selection.set('White') tk.Label(self, text="This is an optionmenu").pack() tk.OptionMenu(self, self.selection, *[x.capitalize() for x in options], command=self.set_color).pack()
Example #21
Source File: dialog_elements.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs): """ Place the required elements using the grid layout method. Returns the number of rows taken by this element. """ label = ttk.Label(master, text=self.text) label.grid(row=row, column=0, columnspan=1, sticky="e") self.entry = ttk.Entry(master, textvariable=self.value) self.entry.grid(row=row, column=1, columnspan=columns - 1, sticky="ew") return 1
Example #22
Source File: runner_window.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master): frame = ttk.Frame(master, padding=(12, 6, 12, 6)) frame.pack() dialog_text_label = ttk.Label(frame, textvariable=self.dialog_text) dialog_text_label.grid(column=0, row=0, sticky="nsew") self.run_button = tk.Button( frame, text="Begin", width=10, command=self.runner, default="active" ) self.run_button.grid(column=0, row=1, sticky="nsew")
Example #23
Source File: runner_window.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master): frame = ttk.Frame(master, padding=(12, 6, 12, 6)) frame.pack() dialog_text_label = ttk.Label(frame, textvariable=self.dialog_text) dialog_text_label.grid(column=0, row=0, sticky="nsew")
Example #24
Source File: create_seqlib_dialog.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master): message = ttk.Label(master, text="SeqLib type:") message.grid(column=0, row=0) for i, k in enumerate(SEQLIB_LABEL_TEXT.keys()): rb = ttk.Radiobutton( master, text=SEQLIB_LABEL_TEXT[k], variable=self.element_tkstring, value=k, ) rb.grid(column=0, row=(i + 1), sticky="w") if i == 0: rb.invoke()
Example #25
Source File: tooltip.py From tkcalendar with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): """ Construct a Tooltip with parent master. Keyword Options --------------- ttk.Label options, alpha: float. Tooltip opacity between 0 and 1. """ tk.Toplevel.__init__(self, parent, padx=0, pady=0) self.transient(parent) self.overrideredirect(True) self.update_idletasks() self.attributes('-alpha', kwargs.pop('alpha', 0.8)) if platform == 'linux': self.attributes('-type', 'tooltip') if not Tooltip._initialized: # default tooltip style style = ttk.Style(self) style.configure('tooltip.TLabel', foreground='gray90', background='black', font='TkDefaultFont 9 bold') Tooltip._initialized = True # default options kw = {'compound': 'left', 'style': 'tooltip.TLabel', 'padding': 4} # update with given options kw.update(kwargs) self.label = ttk.Label(self, **kw) self.label.pack(fill='both') self.config = self.configure
Example #26
Source File: dialog_elements.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs): """ Place the required elements using the grid layout method. Returns the number of rows taken by this element. """ label = ttk.Label(master, text=self.text) label.grid(row=row, column=0, columnspan=1, sticky="e") self.entry = ttk.Entry(master, textvariable=self.value) self.entry.grid(row=row, column=1, columnspan=columns - 1, sticky="ew") if self.directory: self.choose = ttk.Button( master, text="Choose...", command=lambda: self.value.set(tkFileDialog.askdirectory()), ) else: self.choose = ttk.Button( master, text="Choose...", command=lambda: self.value.set(tkFileDialog.askopenfilename()), ) self.choose.grid(row=row + 1, column=1, sticky="w") if self.optional: self.clear = ttk.Button( master, text="Clear", command=lambda: self.value.set("") ) self.clear.grid(row=row + 1, column=2, sticky="e") return 2
Example #27
Source File: dialog_elements.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs): """ Place the required elements using the grid layout method. Returns the number of rows taken by this element. """ label = ttk.Label(master, text=self.text) label.grid(row=row, column=0, columnspan=1, sticky="e") self.entry = ttk.Entry(master, textvariable=self.value) self.entry.grid(row=row, column=1, columnspan=columns - 1, sticky="ew") return 1
Example #28
Source File: dialog_elements.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs): label = ttk.Label(master, text=self.text) label.grid(row=row, column=0, columnspan=columns, sticky="w") return 1
Example #29
Source File: gui.py From stochopy with MIT License | 5 votes |
def _label(self, text, position, kwargs = {}): label = ttk.Label(self.frame1.sliders, text = text, **kwargs) if position == 1: label.place(relx = 0, x = 0, y = 5, anchor = "nw") elif position == 2: label.place(relx = 0, x = 0, y = 50, anchor = "nw") elif position == 3: label.place(relx = 0.5, x = 0, y = 5, anchor = "nw") elif position == 4: label.place(relx = 0.5, x = 0, y = 50, anchor = "nw") return label
Example #30
Source File: gui.py From stochopy with MIT License | 5 votes |
def frame1_pop(self): if not self.frame1.first_run: self.frame1.pop.forget() self.frame1.pop = ttk.Frame(self.frame1, borderwidth = 0) self.frame1.pop.place(width = 170, height = 25, relx = 0.35, y = 30, anchor = "nw") if self.solver_name.get() in self.EAOPT: # popsize popsize_label = ttk.Label(self.frame1.pop, text = "Population size") popsize_spinbox = Spinbox(self.frame1.pop, from_ = 1, to_ = 999, increment = 1, textvariable = self.popsize, width = 3, justify = "right", takefocus = True) # Layout popsize_label.place(relx = 0, x = 0, y = 0, anchor = "nw") popsize_spinbox.place(width = 60, relx = 0, x = 110, y = 0, anchor = "nw")