Python tkinter.E Examples
The following are 30
code examples of tkinter.E().
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
tkinter
, or try the search function
.
Example #1
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 7 votes |
def create_statusbar(self): statusBar = ttk.Frame(self.master) statusLabel = ttk.Label(statusBar, textvariable=self.statusText) statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E)) self.modifiedLabel = ttk.Label(statusBar, relief=tk.SUNKEN, anchor=tk.CENTER) self.modifiedLabel.grid(column=1, row=0, pady=2, padx=1) TkUtil.Tooltip.Tooltip(self.modifiedLabel, text="MOD if the text has unsaved changes") self.positionLabel = ttk.Label(statusBar, relief=tk.SUNKEN, anchor=tk.CENTER) self.positionLabel.grid(column=2, row=0, sticky=(tk.W, tk.E), pady=2, padx=1) TkUtil.Tooltip.Tooltip(self.positionLabel, text="Current line and column position") ttk.Sizegrip(statusBar).grid(row=0, column=4, sticky=(tk.S, tk.E)) statusBar.columnconfigure(0, weight=1) statusBar.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E)) self.set_status_text("Start typing to create a new document or " "click FileāOpen")
Example #2
Source File: data_entry_app.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.title("ABQ Data Entry Application") self.resizable(width=False, height=False) ttk.Label( self, text="ABQ Data Entry Application", font=("TkDefaultFont", 16) ).grid(row=0) self.recordform = DataRecordForm(self) self.recordform.grid(row=1, padx=10) self.savebutton = ttk.Button(self, text="Save", command=self.on_save) self.savebutton.grid(sticky=tk.E, row=2, padx=10) # status bar self.status = tk.StringVar() self.statusbar = ttk.Label(self, textvariable=self.status) self.statusbar.grid(sticky=(tk.W + tk.E), row=3, padx=10) self.records_saved = 0
Example #3
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def layout_widgets(self): pad = dict(padx=PAD, pady=PAD) padWE = dict(sticky=(tk.W, tk.E), **pad) self.sourceLabel.grid(row=0, column=0, sticky=tk.W, **pad) self.sourceEntry.grid(row=0, column=1, columnspan=3, **padWE) self.sourceButton.grid(row=0, column=4, **pad) self.targetLabel.grid(row=1, column=0, sticky=tk.W, **pad) self.targetEntry.grid(row=1, column=1, columnspan=3, **padWE) self.targetButton.grid(row=1, column=4, **pad) self.dimensionLabel.grid(row=2, column=0, sticky=tk.W, **pad) self.dimensionCombobox.grid(row=2, column=1, **padWE) self.helpButton.grid(row=2, column=3, **pad) self.scaleButton.grid(row=2, column=4, **pad) self.aboutButton.grid(row=3, column=3, **pad) self.quitButton.grid(row=3, column=4, **pad) self.statusLabel.grid(row=3, column=0, columnspan=3, **padWE) self.grid()
Example #4
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def create_layout(self): pad = dict(padx=PAD, pady=PAD) padWE = dict(sticky=(tk.W, tk.E), **pad) self.findLabel.grid(row=0, column=0, sticky=tk.W, **pad) self.findEntry.grid(row=0, column=1, **padWE) self.replaceLabel.grid(row=1, column=0, sticky=tk.W, **pad) self.replaceEntry.grid(row=1, column=1, **padWE) self.caseSensitiveCheckbutton.grid(row=2, column=0, columnspan=2, **padWE) self.wholeWordsCheckbutton.grid(row=3, column=0, columnspan=2, **padWE) self.findButton.grid(row=0, column=2, **padWE) self.replaceButton.grid(row=1, column=2, **padWE) self.closeButton.grid(row=2, column=2, **padWE) self.extendButton.grid(row=3, column=2, **padWE) self.grid_columnconfigure(1, weight=1) self.minsize(180, 90) self.maxsize(600, 150) self.geometry("+{}+{}".format(self.master.winfo_rootx() + 200, self.master.winfo_rooty() - 30))
Example #5
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def create_layout(self): pad = dict(padx=PAD, pady=PAD) padWE = dict(sticky=(tk.W, tk.E), **pad) self.findLabel.grid(row=0, column=0, sticky=tk.W, **pad) self.findEntry.grid(row=0, column=1, **padWE) self.replaceLabel.grid(row=1, column=0, sticky=tk.W, **pad) self.replaceEntry.grid(row=1, column=1, **padWE) self.caseSensitiveCheckbutton.grid(row=2, column=0, columnspan=2, **padWE) self.wholeWordsCheckbutton.grid(row=3, column=0, columnspan=2, **padWE) self.findButton.grid(row=0, column=2, **padWE) self.replaceButton.grid(row=1, column=2, **padWE) self.closeButton.grid(row=2, column=2, **padWE) self.extendButton.grid(row=3, column=2, **padWE) self.grid_columnconfigure(1, weight=1) self.minsize(180, 90) self.maxsize(600, 150) self.geometry("+{}+{}".format(self.master.winfo_rootx() + 200, self.master.winfo_rooty() - 30))
Example #6
Source File: load_xls_gui.py From pyDEA with MIT License | 6 votes |
def create_widgets(self, names): ''' Creates appropriate widgets. Args: names (list of str): list of available sheet names. ''' sheet_name_lbl = Label(self, text='Choose sheet name where data is stored:') sheet_name_lbl.grid(sticky=N+W, padx=5, pady=5) sheet_names_box = Combobox(self, state="readonly", width=20, textvariable=self.sheet_name_str, values=names) sheet_names_box.current(0) sheet_names_box.grid(row=1, column=0, columnspan=2, sticky=N+W, padx=5, pady=5) ok_btn = Button(self, text='OK', command=self.ok) ok_btn.grid(row=2, column=0, sticky=N+E, padx=5, pady=5) ok_btn.bind('<Return>', self.ok) ok_btn.focus() cancel_btn = Button(self, text='Cancel', command=self.cancel) cancel_btn.grid(row=2, column=1, sticky=N+E, padx=5, pady=5) cancel_btn.bind('<Return>', self.cancel)
Example #7
Source File: cameraConfig.py From crappy with GNU General Public License v2.0 | 6 votes |
def create_window(self): self.root.grid_rowconfigure(1,weight=1) self.root.grid_columnconfigure(0,weight=1) self.img_label = tk.Label(self.root) self.img_label.configure(image=self.c_img) self.hist_label = tk.Label(self.root) self.hist_label.grid(row=0,column=0) #self.img_label.pack(fill=tk.BOTH) self.img_label.grid(row=1,column=0, rowspan=len(self.camera.settings_dict)+2, sticky=tk.N+tk.E+tk.S+tk.W) self.create_inputs() self.create_infos() self.img_label.bind('<Motion>', self.update_reticle) self.img_label.bind('<4>', self.zoom_in) self.img_label.bind('<5>', self.zoom_out) self.root.bind('<MouseWheel>', self.zoom) self.img_label.bind('<1>', self.start_move) self.img_label.bind('<B1-Motion>', self.move)
Example #8
Source File: text_frame_gui.py From pyDEA with MIT License | 6 votes |
def create_widgets(self): ''' Creates all widgets. ''' self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1) xscrollbar = Scrollbar(self, orient=HORIZONTAL) xscrollbar.grid(row=1, column=0, sticky=E+W) yscrollbar = Scrollbar(self) yscrollbar.grid(row=0, column=1, sticky=N+S) self.text = Text(self, wrap=NONE, xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set) self.text.bind("<Control-Key-a>", self.select_all) self.text.bind("<Control-Key-A>", self.select_all) self.text.grid(row=0, column=0, sticky=N+S+E+W) xscrollbar.config(command=self.text.xview) yscrollbar.config(command=self.text.yview)
Example #9
Source File: price_display.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, text, textvariable, **kwargs): super().__init__(parent, **kwargs) self.label = tk.Label(self, text=text, font=self.font, anchor=tk.E) self.entry = tk.Entry(self, textvariable=textvariable, font=self.font, width=len("$ 000.00"), state=tk.DISABLED, disabledforeground="black", disabledbackground="white") self.label.grid(row=0, column=0, sticky="nswe") self.entry.grid(row=0, column=1, sticky="nswe")
Example #10
Source File: UICommon.py From RaspberryPiBarcodeScanner with MIT License | 6 votes |
def table(self, master, title, content, target=None, backgroundcolour="White", foregroundcolour="black", bordercolour="grey", borderwidth=1, fontstyle="DejaVuSans 18 normal"): # creates a table from a 2 dimensional array. # master: = this represents the parent window # content: a 2 dimensional array containing the table contents # First column in the array must be the row id which is returned on a click event. This will not be displayed in the table index = 0 for i in range(len(content)): #Rows for j in range(len(content[i])): if j==0: index = content[i][j] else: b = tk.Label(master, text=str(content[i][j]), background=backgroundcolour, foreground=foregroundcolour,padx=5, pady=10, highlightthickness=borderwidth, highlightbackground=bordercolour, font=fontstyle) if (target is not None): b.bind('<ButtonPress-1>', self.__row_pressed) b.bind('<ButtonRelease-1>', lambda event, arg1=index, arg2=target: self.__row_released(event, arg1, arg2)) b.grid(row=i, column=j-1, sticky=tk.N+tk.S+tk.E+tk.W) return
Example #11
Source File: view.py From ms_deisotope with Apache License 2.0 | 6 votes |
def configure_treeview(self): self.treeview = ttk.Treeview(self) self.treeview['columns'] = ["id", "time", 'ms_level', 'precursor_mz', 'precursor_charge', 'activation'] self.treeview.grid(row=2, column=0, sticky=tk.S + tk.W + tk.E + tk.N) self.treeview_scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.treeview.yview) self.treeview_scrollbar.grid(row=2, column=0, sticky=tk.S + tk.E + tk.N) self.treeview.configure(yscrollcommand=self.treeview_scrollbar.set) self.treeview.heading('id', text="Scan ID") self.treeview.heading('#0', text='Index') self.treeview.heading("time", text='Time (min)') self.treeview.heading("ms_level", text='MS Level') self.treeview.heading("precursor_mz", text='Precursor M/Z') self.treeview.heading("precursor_charge", text='Precursor Z') self.treeview.heading("activation", text='Activation') self.treeview.column("#0", width=75) self.treeview.column("ms_level", width=75) self.treeview.column("time", width=75) self.treeview.column("precursor_mz", width=100) self.treeview.column("precursor_charge", width=100) self.treeview.bind("<<TreeviewSelect>>", self.on_row_click)
Example #12
Source File: data_entry_app.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, parent, label='', input_class=ttk.Entry, input_var=None, input_args=None, label_args=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} self.variable = input_var if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton): input_args["text"] = label input_args["variable"] = input_var else: self.label = ttk.Label(self, text=label, **label_args) self.label.grid(row=0, column=0, sticky=(tk.W + tk.E)) input_args["textvariable"] = input_var self.input = input_class(self, **input_args) self.input.grid(row=1, column=0, sticky=(tk.W + tk.E)) self.columnconfigure(0, weight=1) self.error = getattr(self.input, 'error', tk.StringVar()) self.error_label = ttk.Label(self, textvariable=self.error) self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))
Example #13
Source File: view.py From ms_deisotope with Apache License 2.0 | 6 votes |
def configure_canvas(self): self.figure = Figure(dpi=100) self.canvas = FigureCanvasTkAgg(self.figure, master=self) self.axis = self.figure.add_subplot(111) self.canvas.draw() canvas_widget = self.canvas.get_tk_widget() canvas_widget.grid(row=0, column=0, sticky=tk.N + tk.W + tk.E + tk.S) self.canvas_cursor = Cursor(self.axis, tk.StringVar(master=self.root)) self.canvas.mpl_connect('motion_notify_event', self.canvas_cursor.mouse_move) self.span = SpanSelector( self.axis, self.zoom, 'horizontal', useblit=True, rectprops=dict(alpha=0.5, facecolor='red')) self.mz_span = None self.scan = None self.annotations = [] self.canvas.draw()
Example #14
Source File: better_hello_tkinter.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, parent, *args, **kwargs): super().__init__(parent, *args, **kwargs) self.name = tk.StringVar() self.hello_string = tk.StringVar() self.hello_string.set("Hello World") name_label = ttk.Label(self, text="Name:") name_entry = ttk.Entry(self, textvariable=self.name) ch_button = ttk.Button(self, text="Change", command=self.on_change) hello_label = ttk.Label(self, textvariable=self.hello_string, font=("TkDefaultFont", 64), wraplength=600) # Layout form name_label.grid(row=0, column=0, sticky=tk.W) name_entry.grid(row=0, column=1, sticky=(tk.W + tk.E)) ch_button.grid(row=0, column=2, sticky=tk.E) hello_label.grid(row=1, column=0, columnspan=3) self.columnconfigure(1, weight=1)
Example #15
Source File: data_entry_app.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, parent, label='', input_class=ttk.Entry, input_var=None, input_args=None, label_args=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} self.variable = input_var if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton): input_args["text"] = label input_args["variable"] = input_var else: self.label = ttk.Label(self, text=label, **label_args) self.label.grid(row=0, column=0, sticky=(tk.W + tk.E)) input_args["textvariable"] = input_var self.input = input_class(self, **input_args) self.input.grid(row=1, column=0, sticky=(tk.W + tk.E)) self.columnconfigure(0, weight=1)
Example #16
Source File: text_for_weights_gui.py From pyDEA with MIT License | 5 votes |
def create_widgets(self, weight_name): ''' Creates all widgets. ''' constraints_lbl = Label( self, text='Enter {0} weight restrictions:'.format( weight_name)) constraints_lbl.grid(padx=10, pady=2, sticky=N+W) examples_lbl = Label(self, text='e.g. {0}'.format(self.examples)) examples_lbl.grid(row=1, column=0, padx=10, pady=5, sticky=N+W) errors_lbl = Label(self, textvariable=self.errors_strvar, foreground='red', anchor=W, justify=LEFT, wraplength=80) errors_lbl.grid(row=2, column=2, sticky=N+W, padx=5, pady=5) self.grid_rowconfigure(2, weight=1) self.grid_columnconfigure(0, weight=1) xscrollbar = Scrollbar(self, orient=HORIZONTAL) xscrollbar.grid(row=3, column=0, sticky=E+W) yscrollbar = Scrollbar(self) yscrollbar.grid(row=2, column=1, sticky=N+S) self.text = Text(self, wrap=NONE, width=TEXT_WIDTH_VAL, height=TEXT_HEIGHT_VAL, xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set) self.text.grid(row=2, column=0, sticky=N+S+E+W) xscrollbar.config(command=self.text.xview) yscrollbar.config(command=self.text.yview)
Example #17
Source File: table_gui.py From pyDEA with MIT License | 5 votes |
def add_column(self): ''' Adds one column to the end of the table. ''' for i in range(self.nb_rows): grid_row_index = i + 2 ent = self.create_entry_widget(self.frame_with_table) ent.grid(row=grid_row_index, column=self.nb_cols + 1, sticky=N+S+E+W) self.cells[i].append(ent) self.nb_cols += 1 self._update_scroll_region()
Example #18
Source File: weight_frame_gui.py From pyDEA with MIT License | 5 votes |
def create_widgets(self): ''' Creates all widgets. ''' self.columnconfigure(0, weight=1) self.rowconfigure(1, weight=1) validate_btn = Button(self, text='Validate weight restrictions', command=self.on_validate_weights) validate_btn.grid(row=0, column=0, padx=10, pady=5, sticky=N+W) panel = LabelFrame(self, text='Weight restrictions') panel.columnconfigure(0, weight=1) panel.rowconfigure(0, weight=1) panel.grid(row=1, column=0, padx=5, pady=5, sticky=E+W+S+N) weight_tab_main = VerticalScrolledFrame(panel) weight_tab_main.grid(row=0, column=0, sticky=E+W+S+N) weights_tab = weight_tab_main.interior self.abs_weights = TextForWeights(weights_tab, 'absolute', 'Input1 <= 0.02', self.current_categories, self.params, 'ABS_WEIGHT_RESTRICTIONS') self.abs_weights.grid(row=0, column=0, padx=10, pady=5, sticky=N+W) self.virtual_weights = TextForWeights(weights_tab, 'virtual', 'Input1 >= 0.34', self.current_categories, self.params, 'VIRTUAL_WEIGHT_RESTRICTIONS') self.virtual_weights.grid(row=1, column=0, padx=10, pady=5, sticky=N+W) self.price_ratio_weights = TextForWeights(weights_tab, 'price ratio', 'Input1/Input2 <= 5', self.current_categories, self.params, 'PRICE_RATIO_RESTRICTIONS', True) self.price_ratio_weights.grid(row=2, column=0, padx=10, pady=5, sticky=N+W)
Example #19
Source File: solution_tab_frame_gui.py From pyDEA with MIT License | 5 votes |
def create_widgets(self): ''' Creates appropriate widgets on this frame. ''' self.columnconfigure(0, weight=1) self.rowconfigure(3, weight=1) frame_for_save_btn = Frame(self) frame_for_save_btn.columnconfigure(1, weight=1) self.status_lbl = Label(frame_for_save_btn, text='') self.status_lbl.grid(row=0, column=1, sticky=N+W) save_solution_btn = Button(frame_for_save_btn, text='Save solution', command=self.on_save_solution) save_solution_btn.grid(row=1, column=0, sticky=W+N, padx=5, pady=5) self.progress_bar = Progressbar(frame_for_save_btn, mode='determinate', maximum=100) self.progress_bar.grid(row=1, column=1, sticky=W+E, padx=10, pady=5) frame_for_save_btn.grid(sticky=W+N+E+S, padx=5, pady=5) frame_for_btns = Frame(self) self._create_file_format_btn('*.xlsx', 1, frame_for_btns, 0) self._create_file_format_btn('*.xls', 2, frame_for_btns, 1) self._create_file_format_btn('*.csv', 3, frame_for_btns, 2) self.solution_format_var.set(1) frame_for_btns.grid(row=1, column=0, sticky=W+N+E+S, padx=5, pady=5) self.data_from_file_lbl = Label(self, text=TEXT_FOR_FILE_LBL, anchor=W, justify=LEFT, wraplength=MAX_FILE_PARAMS_LBL_LENGTH) self.data_from_file_lbl.grid(row=2, column=0, padx=5, pady=5, sticky=W+N) self.solution_tab = SolutionFrameWithText(self) self.solution_tab.grid(row=3, column=0, sticky=W+E+S+N, padx=5, pady=5)
Example #20
Source File: view.py From ms_deisotope with Apache License 2.0 | 5 votes |
def do_layout(self): self.grid(sticky=tk.N + tk.W + tk.E + tk.S) tk.Grid.rowconfigure(self, 0, weight=1) tk.Grid.columnconfigure(self, 0, weight=1)
Example #21
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def grid(self, sticky=(tk.E + tk.W), **kwargs): super().grid(sticky=sticky, **kwargs)
Example #22
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def __init__(self, parent, label='', input_class=None, input_var=None, input_args=None, label_args=None, field_spec=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} if field_spec: field_type = field_spec.get('type', FT.string) input_class = input_class or self.field_types.get(field_type)[0] var_type = self.field_types.get(field_type)[1] self.variable = input_var if input_var else var_type() # min, max, increment if 'min' in field_spec and 'from_' not in input_args: input_args['from_'] = field_spec.get('min') if 'max' in field_spec and 'to' not in input_args: input_args['to'] = field_spec.get('max') if 'inc' in field_spec and 'increment' not in input_args: input_args['increment'] = field_spec.get('inc') # values if 'values' in field_spec and 'values' not in input_args: input_args['values'] = field_spec.get('values') else: self.variable = input_var if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton): input_args["text"] = label input_args["variable"] = self.variable else: self.label = ttk.Label(self, text=label, **label_args) self.label.grid(row=0, column=0, sticky=(tk.W + tk.E)) input_args["textvariable"] = self.variable self.input = input_class(self, **input_args) self.input.grid(row=1, column=0, sticky=(tk.W + tk.E)) self.columnconfigure(0, weight=1) self.error = getattr(self.input, 'error', tk.StringVar()) self.error_label = ttk.Label(self, textvariable=self.error, **label_args) self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))
Example #23
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def grid(self, sticky=(tk.E + tk.W), **kwargs): super().grid(sticky=sticky, **kwargs)
Example #24
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def __init__(self, parent, label='', input_class=None, input_var=None, input_args=None, label_args=None, field_spec=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} if field_spec: field_type = field_spec.get('type', FT.string) input_class = input_class or self.field_types.get(field_type)[0] var_type = self.field_types.get(field_type)[1] self.variable = input_var if input_var else var_type() # min, max, increment if 'min' in field_spec and 'from_' not in input_args: input_args['from_'] = field_spec.get('min') if 'max' in field_spec and 'to' not in input_args: input_args['to'] = field_spec.get('max') if 'inc' in field_spec and 'increment' not in input_args: input_args['increment'] = field_spec.get('inc') # values if 'values' in field_spec and 'values' not in input_args: input_args['values'] = field_spec.get('values') else: self.variable = input_var if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton): input_args["text"] = label input_args["variable"] = self.variable else: self.label = ttk.Label(self, text=label, **label_args) self.label.grid(row=0, column=0, sticky=(tk.W + tk.E)) input_args["textvariable"] = self.variable self.input = input_class(self, **input_args) self.input.grid(row=1, column=0, sticky=(tk.W + tk.E)) self.columnconfigure(0, weight=1) self.error = getattr(self.input, 'error', tk.StringVar()) self.error_label = ttk.Label(self, textvariable=self.error) self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))
Example #25
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def grid(self, sticky=(tk.E + tk.W), **kwargs): super().grid(sticky=sticky, **kwargs)
Example #26
Source File: better_hello_tkinter.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # set the window properties self.title("Hello Tkinter") self.geometry("800x600") self.resizable(width=False, height=False) # Define the UI HelloView(self).grid(sticky=(tk.E + tk.W + tk.N + tk.S)) self.columnconfigure(0, weight=1)
Example #27
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def grid(self, sticky=(tk.E + tk.W), **kwargs): super().grid(sticky=sticky, **kwargs)
Example #28
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def __init__(self, parent, label='', input_class=None, input_var=None, input_args=None, label_args=None, field_spec=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} if field_spec: field_type = field_spec.get('type', FT.string) input_class = input_class or self.field_types.get(field_type)[0] var_type = self.field_types.get(field_type)[1] self.variable = input_var if input_var else var_type() # min, max, increment if 'min' in field_spec and 'from_' not in input_args: input_args['from_'] = field_spec.get('min') if 'max' in field_spec and 'to' not in input_args: input_args['to'] = field_spec.get('max') if 'inc' in field_spec and 'increment' not in input_args: input_args['increment'] = field_spec.get('inc') # values if 'values' in field_spec and 'values' not in input_args: input_args['values'] = field_spec.get('values') else: self.variable = input_var if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton): input_args["text"] = label input_args["variable"] = self.variable else: self.label = ttk.Label(self, text=label, **label_args) self.label.grid(row=0, column=0, sticky=(tk.W + tk.E)) input_args["textvariable"] = self.variable self.input = input_class(self, **input_args) self.input.grid(row=1, column=0, sticky=(tk.W + tk.E)) self.columnconfigure(0, weight=1) self.error = getattr(self.input, 'error', tk.StringVar()) self.error_label = ttk.Label(self, textvariable=self.error, **label_args) self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))
Example #29
Source File: gui.py From copycat with MIT License | 5 votes |
def __init__(self, title): self.root = tk.Tk() self.root.title(title) tk.Grid.rowconfigure(self.root, 0, weight=1) tk.Grid.columnconfigure(self.root, 0, weight=1) self.app = MainApplication(self.root) self.app.grid(row=0, column=0, sticky=tk.N+tk.S+tk.E+tk.W) configure_style(ttk.Style())
Example #30
Source File: pyjsonviewer.py From PyJSONViewer with MIT License | 5 votes |
def create_widgets(self): self.tree.bind('<Double-1>', self.click_item) ysb = ttk.Scrollbar( self, orient=tk.VERTICAL, command=self.tree.yview) self.tree.configure(yscroll=ysb.set) self.tree.grid(row=0, column=0, sticky=(tk.N, tk.S, tk.E, tk.W)) ysb.grid(row=0, column=1, sticky=(tk.N, tk.S)) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1)