Python tkinter.NSEW Examples
The following are 30
code examples of tkinter.NSEW().
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: tktextext.py From thonny with MIT License | 6 votes |
def set_gutter_visibility(self, value): if value and not self._gutter_is_gridded: self._gutter.grid(row=0, column=0, sticky=tk.NSEW) self._gutter_is_gridded = True elif not value and self._gutter_is_gridded: self._gutter.grid_forget() self._gutter_is_gridded = False else: return """ # insert first line number (NB! Without trailing linebreak. See update_gutter) self._gutter.config(state="normal") self._gutter.delete("1.0", "end") for content, tags in self.compute_gutter_line(self._first_line_number): self._gutter.insert("end", content, ("content",) + tags) self._gutter.config(state="disabled") """ self.update_gutter(True)
Example #2
Source File: recipe-577637.py From code with MIT License | 6 votes |
def main(cls): # Create and configure the root. tkinter.NoDefaultRoot() root = tkinter.Tk() root.title('Logos') root.minsize(200, 200) # Create Logos and setup for resizing. view = cls(root) view.grid(row=0, column=0, sticky=tkinter.NSEW) root.grid_rowconfigure(0, weight=1) root.grid_columnconfigure(0, weight=1) # Enter the main GUI event loop. root.mainloop() ######################################################################## # These are all instance methods.
Example #3
Source File: CInScan02.py From mcculw with MIT License | 6 votes |
def __init__(self, master=None): super(CInScan02, self).__init__(master) self.board_num = 0 self.ctr_props = CounterProps(self.board_num) chan = next( (channel for channel in self.ctr_props.counter_info if channel.type == CounterChannelType.CTRSCAN), None) if chan != None: self.chan_num = chan.channel_num else: self.chan_num = -1 # Initialize tkinter self.grid(sticky=tk.NSEW) self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) self.create_widgets()
Example #4
Source File: ULFL01.py From mcculw with MIT License | 6 votes |
def create_widgets(self): '''Create the tkinter UI''' self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(1, weight=1) self.grid_rowconfigure(0, weight=1) self.flash_led_button = tk.Button(self) self.flash_led_button["text"] = "Flash LED" self.flash_led_button["command"] = self.flash_led self.flash_led_button.grid( row=0, column=0, padx=3, pady=3, sticky=tk.NSEW) quit_button = tk.Button(self) quit_button["text"] = "Quit" quit_button["command"] = self.master.destroy quit_button.grid( row=0, column=1, padx=3, pady=3, sticky=tk.NSEW) # Start the example if this module is being run
Example #5
Source File: recipe-577525.py From code with MIT License | 6 votes |
def __init__(self, master): # Initialize the Frame object. super().__init__(master) # Create every opening widget. self.intro = Label(self, text=self.PROMPT) self.group = LabelFrame(self, text='Filename') self.entry = Entry(self.group, width=35) self.click = Button(self.group, text='Browse ...', command=self.file) self.enter = Button(self, text='Continue', command=self.start) # Make Windows entry bindings. def select_all(event): event.widget.selection_range(0, tkinter.END) return 'break' self.entry.bind('<Control-Key-a>', select_all) self.entry.bind('<Control-Key-/>', lambda event: 'break') # Position them in this frame. options = {'sticky': tkinter.NSEW, 'padx': 5, 'pady': 5} self.intro.grid(row=0, column=0, **options) self.group.grid(row=1, column=0, **options) self.entry.grid(row=0, column=0, **options) self.click.grid(row=0, column=1, **options) self.enter.grid(row=2, column=0, **options)
Example #6
Source File: hr_menu.py From hackerrank with The Unlicense | 6 votes |
def show_data(data): # Setup the root UI root = tk.Tk() root.title("JSON viewer") root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) # Setup the Frames tree_frame = ttk.Frame(root, padding="3") tree_frame.grid(row=0, column=0, sticky=tk.NSEW) # Setup the Tree tree = ttk.Treeview(tree_frame, columns='Values') tree.tag_configure("d", foreground='blue') tree.column('Values', width=100) tree.heading('Values', text='Values') json_tree(tree, '', data) tree.pack(fill=tk.BOTH, expand=1) # Limit windows minimum dimensions root.update_idletasks() root.minsize(500, 500) raise_app() root.mainloop()
Example #7
Source File: box.py From synthesizer with GNU Lesser General Public License v3.0 | 6 votes |
def __init__(self, app, master): super().__init__(master, text="Playlist", padding=4) self.app = app bf = ttk.Frame(self) ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack() ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack() ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack() ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack() bf.pack(side=tk.LEFT, padx=4) sf = ttk.Frame(self) cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 80)] self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings") vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview) self.listTree.configure(yscrollcommand=vsb.set) self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf) vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf) for col, colwidth in cols: self.listTree.heading(col, text=col.title()) self.listTree.column(col, width=colwidth) sf.grid_columnconfigure(0, weight=1) sf.grid_rowconfigure(0, weight=1) sf.pack(side=tk.LEFT, padx=4)
Example #8
Source File: ui_utils.py From thonny with MIT License | 6 votes |
def __init__(self, master): ttk.Frame.__init__(self, master) # set up scrolling with canvas vscrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL) self.canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set) vscrollbar.config(command=self.canvas.yview) self.canvas.xview_moveto(0) self.canvas.yview_moveto(0) self.canvas.grid(row=0, column=0, sticky=tk.NSEW) vscrollbar.grid(row=0, column=1, sticky=tk.NSEW) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.interior = ttk.Frame(self.canvas) self.interior_id = self.canvas.create_window(0, 0, window=self.interior, anchor=tk.NW) self.bind("<Configure>", self._configure_interior, "+") self.bind("<Expose>", self._expose, "+")
Example #9
Source File: object_inspector.py From thonny with MIT License | 6 votes |
def update_type_specific_info(self, object_info): content_inspector = None for insp in self.content_inspectors: if insp.applies_to(object_info): content_inspector = insp break # print("TYPSE", content_inspector) if content_inspector != self.current_content_inspector: if self.current_content_inspector is not None: self.current_content_inspector.grid_remove() # TODO: or forget? self.current_content_inspector = None if content_inspector is not None: content_inspector.grid(row=0, column=0, sticky=tk.NSEW, padx=(0, 0)) self.current_content_inspector = content_inspector if self.current_content_inspector is not None: self.current_content_inspector.set_object_info(object_info)
Example #10
Source File: outline.py From thonny with MIT License | 6 votes |
def _init_widgets(self): # init and place scrollbar self.vert_scrollbar = SafeScrollbar(self, orient=tk.VERTICAL) self.vert_scrollbar.grid(row=0, column=1, sticky=tk.NSEW) # init and place tree self.tree = ttk.Treeview(self, yscrollcommand=self.vert_scrollbar.set) self.tree.grid(row=0, column=0, sticky=tk.NSEW) self.vert_scrollbar["command"] = self.tree.yview # set single-cell frame self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) # init tree events self.tree.bind("<<TreeviewSelect>>", self._on_select, True) self.tree.bind("<Map>", self._update_frame_contents, True) # configure the only tree column self.tree.column("#0", anchor=tk.W, stretch=True) # self.tree.heading('#0', text='Item (type @ line)', anchor=tk.W) self.tree["show"] = ("tree",) self._class_img = get_workbench().get_image("outline-class") self._method_img = get_workbench().get_image("outline-method")
Example #11
Source File: pip_gui.py From thonny with MIT License | 6 votes |
def __init__(self, master): self._state = "idle" # possible values: "listing", "fetching", "idle" self._process = None self._active_distributions = {} self.current_package_data = None super().__init__(master) main_frame = ttk.Frame(self) main_frame.grid(sticky=tk.NSEW, ipadx=15, ipady=15) self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.title(self._get_title()) self._create_widgets(main_frame) self.search_box.focus_set() self.bind("<Escape>", self._on_close, True) self.protocol("WM_DELETE_WINDOW", self._on_close) self._show_instructions() self._start_update_list()
Example #12
Source File: ui_utils.py From thonny with MIT License | 5 votes |
def __init__( self, master, columns, displaycolumns="#all", show_scrollbar=True, show_statusbar=False, borderwidth=0, relief="flat", **tree_kw ): ttk.Frame.__init__(self, master, borderwidth=borderwidth, relief=relief) # http://wiki.tcl.tk/44444#pagetoc50f90d9a self.vert_scrollbar = ttk.Scrollbar( self, orient=tk.VERTICAL, style=scrollbar_style("Vertical") ) if show_scrollbar: self.vert_scrollbar.grid( row=0, column=1, sticky=tk.NSEW, rowspan=2 if show_statusbar else 1 ) self.tree = ttk.Treeview( self, columns=columns, displaycolumns=displaycolumns, yscrollcommand=self.vert_scrollbar.set, **tree_kw ) self.tree["show"] = "headings" self.tree.grid(row=0, column=0, sticky=tk.NSEW) self.vert_scrollbar["command"] = self.tree.yview self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.tree.bind("<<TreeviewSelect>>", self.on_select, "+") self.tree.bind("<Double-Button-1>", self.on_double_click, "+") if show_statusbar: self.statusbar = ttk.Frame(self) self.statusbar.grid(row=1, column=0, sticky="nswe") else: self.statusbar = None
Example #13
Source File: shell_macro.py From thonny with MIT License | 5 votes |
def _create_widgets(self): bg = "#ffff99" banner_frame = tk.Frame(self, background=bg) banner_frame.grid(row=0, column=0, sticky="nsew") banner_frame.rowconfigure(0, weight=1) banner_frame.columnconfigure(0, weight=1) banner_text = tk.Label( banner_frame, text="These\nare\ninstructions asdfa afs fa sfasdf", background=bg, justify="left", ) banner_text.grid(column=0, row=0, pady=10, padx=10, sticky="nsew") main_frame = ttk.Frame(self) main_frame.grid(row=1, column=0, sticky=tk.NSEW, padx=15, pady=15) self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.main_command_text = CodeView(main_frame, height=5) self.main_command_text.grid(column=0, row=1, sticky="nsew") # main_command_text["relief"] = "groove" main_frame.rowconfigure(1, weight=1) main_frame.columnconfigure(0, weight=1) button_frame = ttk.Frame(main_frame) button_frame.grid(row=2, column=0, sticky="nsew") run_button = ttk.Button(button_frame, text="Save and execute", command=self._save_exec) run_button.grid(row=0, column=1, sticky="nsew") ok_button = ttk.Button(button_frame, text="Save", command=self._save) ok_button.grid(row=0, column=2, sticky="nsew") cancel_button = ttk.Button(button_frame, text="Cancel", command=self._cancel) cancel_button.grid(row=0, column=3, sticky="nsew") button_frame.columnconfigure(0, weight=1)
Example #14
Source File: debugger.py From thonny with MIT License | 5 votes |
def _init_layout_widgets(self, master, frame_info): self.main_frame = ttk.Frame( self ) # just a backgroud behind padding of main_pw, without this OS X leaves white border self.main_frame.grid(sticky=tk.NSEW) self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.main_pw = ui_utils.AutomaticPanedWindow(self.main_frame, orient=tk.VERTICAL) self.main_pw.grid(sticky=tk.NSEW, padx=10, pady=10) self.main_frame.rowconfigure(0, weight=1) self.main_frame.columnconfigure(0, weight=1) self._code_book = ttk.Notebook(self.main_pw) self._text_frame = CodeView( self._code_book, first_line_number=frame_info.firstlineno, font="EditorFont" ) self._code_book.add(self._text_frame, text="Source") self.main_pw.add(self._code_book, minsize=200) self._code_book.preferred_size_in_pw = 400
Example #15
Source File: recipe-577637.py From code with MIT License | 5 votes |
def __init__(self, master): super().__init__(master) # Get the username and save list of found files. self.__user = getpass.getuser() self.__dirlist = set() # Create widgets. self.__log = tkinter.Text(self) self.__bar = tkinter.ttk.Scrollbar(self, orient=tkinter.VERTICAL, command=self.__log.yview) self.__ent = tkinter.ttk.Entry(self, cursor='xterm') # Configure widgets. self.__log.configure(state=tkinter.DISABLED, wrap=tkinter.WORD, yscrollcommand=self.__bar.set) # Create binding. self.__ent.bind('<Return>', self.create_message) # Position widgets. self.__log.grid(row=0, column=0, sticky=tkinter.NSEW) self.__bar.grid(row=0, column=1, sticky=tkinter.NS) self.__ent.grid(row=1, column=0, columnspan=2, sticky=tkinter.EW) # Configure resizing. self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1) # Focus entry. self.__ent.focus_set() # Schedule message discovery. self.after_idle(self.get_messages)
Example #16
Source File: replayer.py From thonny with MIT License | 5 votes |
def __init__(self, master): ttk.Frame.__init__(self, master) self.code_view = ReplayerCodeView(self) self.code_view.grid(sticky=tk.NSEW) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1)
Example #17
Source File: replayer.py From thonny with MIT License | 5 votes |
def __init__(self, master): ttk.Frame.__init__(self, master) self.vbar = ttk.Scrollbar(self, orient=tk.VERTICAL) self.vbar.grid(row=0, column=2, sticky=tk.NSEW) self.hbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL) self.hbar.grid(row=1, column=0, sticky=tk.NSEW, columnspan=2) self.text = codeview.SyntaxText( self, yscrollcommand=self.vbar.set, xscrollcommand=self.hbar.set, borderwidth=0, font="EditorFont", wrap=tk.NONE, insertwidth=2, # selectborderwidth=2, inactiveselectbackground="gray", # highlightthickness=0, # TODO: try different in Mac and Linux # highlightcolor="gray", padx=5, pady=5, undo=True, autoseparators=False, ) self.text.grid(row=0, column=1, sticky=tk.NSEW) self.hbar["command"] = self.text.xview self.vbar["command"] = self.text.yview self.columnconfigure(1, weight=1) self.rowconfigure(0, weight=1)
Example #18
Source File: box.py From synthesizer with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, app, master): super().__init__(master, text="Search song", padding=4) self.app = app self.search_text = tk.StringVar() self.filter_choice = tk.StringVar(value="title") bf = ttk.Frame(self) ttk.Label(bf, text="Search for:").pack() e = ttk.Entry(bf, textvariable=self.search_text) e.bind("<Return>", self.do_search) e.bind("<KeyRelease>", self.on_key_up) self.search_job = None e.pack() ttk.Radiobutton(bf, text="title", value="title", variable=self.filter_choice, width=10).pack() ttk.Radiobutton(bf, text="artist", value="artist", variable=self.filter_choice, width=10).pack() ttk.Radiobutton(bf, text="album", value="album", variable=self.filter_choice, width=10).pack() ttk.Radiobutton(bf, text="year", value="year", variable=self.filter_choice, width=10).pack() ttk.Radiobutton(bf, text="genre", value="genre", variable=self.filter_choice, width=10).pack() ttk.Button(bf, text="Search", command=self.do_search).pack() ttk.Button(bf, text="Add all selected", command=self.do_add_selected).pack() bf.pack(side=tk.LEFT) sf = ttk.Frame(self) cols = [("title", 320), ("artist", 200), ("album", 200), ("year", 60), ("genre", 160), ("length", 80)] self.resultTreeView = ttk.Treeview(sf, columns=[col for col, _ in cols], height=16, show="headings") vsb = ttk.Scrollbar(orient="vertical", command=self.resultTreeView.yview) self.resultTreeView.configure(yscrollcommand=vsb.set) self.resultTreeView.grid(column=1, row=0, sticky=tk.NSEW, in_=sf) vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf) for col, colwidth in cols: self.resultTreeView.heading(col, text=col.title(), command=lambda c=col: self.sortby(self.resultTreeView, c, 0)) self.resultTreeView.column(col, width=colwidth) self.resultTreeView.bind("<Double-1>", self.on_doubleclick) sf.grid_columnconfigure(0, weight=1) sf.grid_rowconfigure(0, weight=1) sf.pack(side=tk.LEFT, padx=4)
Example #19
Source File: replayer.py From thonny with MIT License | 5 votes |
def __init__(self): super().__init__(get_workbench(), background=lookup_style_option("TFrame", "background")) ui_utils.set_zoomed(self, True) self.main_pw = ReplayerPanedWindow(self, orient=tk.HORIZONTAL, sashwidth=10) self.center_pw = ReplayerPanedWindow(self.main_pw, orient=tk.VERTICAL, sashwidth=10) self.right_frame = ttk.Frame(self.main_pw) self.right_pw = ReplayerPanedWindow(self.right_frame, orient=tk.VERTICAL, sashwidth=10) self.editor_notebook = ReplayerEditorNotebook(self.center_pw) shell_book = ttk.Notebook(self.main_pw) self.shell = ShellFrame(shell_book) self.details_frame = EventDetailsFrame(self.right_pw) self.log_frame = LogFrame( self.right_pw, self.editor_notebook, self.shell, self.details_frame ) self.browser = ReplayerFileBrowser(self.main_pw, self.log_frame) self.control_frame = ControlFrame(self.right_frame) self.main_pw.grid(padx=10, pady=10, sticky=tk.NSEW) self.main_pw.add(self.browser, width=200) self.main_pw.add(self.center_pw, width=1000) self.main_pw.add(self.right_frame, width=200) self.center_pw.add(self.editor_notebook, height=700) self.center_pw.add(shell_book, height=300) shell_book.add(self.shell, text="Shell") self.right_pw.grid(sticky=tk.NSEW) self.control_frame.grid(sticky=tk.NSEW) self.right_pw.add(self.log_frame, height=600) self.right_pw.add(self.details_frame, height=200) self.right_frame.columnconfigure(0, weight=1) self.right_frame.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1)
Example #20
Source File: ui_utils.py From thonny with MIT License | 5 votes |
def __init__(self, master): ttk.Frame.__init__(self, master) # set up scrolling with canvas vscrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL) hscrollbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL) self.canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set) vscrollbar.config(command=self.canvas.yview) hscrollbar.config(command=self.canvas.xview) self.canvas.xview_moveto(0) self.canvas.yview_moveto(0) self.canvas.grid(row=0, column=0, sticky=tk.NSEW) vscrollbar.grid(row=0, column=1, sticky=tk.NSEW) hscrollbar.grid(row=1, column=0, sticky=tk.NSEW) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.interior = ttk.Frame(self.canvas) self.interior.columnconfigure(0, weight=1) self.interior.rowconfigure(0, weight=1) self.interior_id = self.canvas.create_window(0, 0, window=self.interior, anchor=tk.NW) self.bind("<Configure>", self._configure_interior, "+") self.bind("<Expose>", self._expose, "+")
Example #21
Source File: gridtable.py From thonny with MIT License | 5 votes |
def __init__(self, master, header_rows, data_row_count, footer_row_count, frozen_column_count): ttk.Frame.__init__(self, master) # set up scrolling with canvas hscrollbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL) self.canvas = tk.Canvas(self, bd=0, highlightthickness=0, xscrollcommand=hscrollbar.set) get_workbench().bind_all("<Control-r>", self.debug) self.create_infopanel(data_row_count) hscrollbar.config(command=self.canvas.xview) self.canvas.xview_moveto(0) self.canvas.yview_moveto(0) self.canvas.grid(row=0, column=0, columnspan=2, sticky=tk.NSEW) self.infopanel.grid(row=1, column=0, sticky=tk.NSEW) hscrollbar.grid(row=1, column=1, sticky=tk.NSEW) # vertical scrollbar performs virtual scrolling self.vscrollbar = ttk.Scrollbar( self, orient=tk.VERTICAL, command=self._handle_vertical_scroll ) self.vscrollbar.grid(row=0, column=2, sticky=tk.NSEW) self.columnconfigure(1, weight=1) self.rowconfigure(0, weight=1) self.interior = ttk.Frame(self.canvas) self.interior.columnconfigure(0, weight=1) self.interior.rowconfigure(0, weight=1) self.interior_id = self.canvas.create_window(0, 0, window=self.interior, anchor=tk.NW) self.bind("<Configure>", self._configure_interior, True) self.bind("<Expose>", self._on_expose, True) self.grid_table = GridTable( self.interior, header_rows, data_row_count, footer_row_count, frozen_column_count ) self.grid_table.grid(row=0, column=0, sticky=tk.NSEW) self._update_vertical_scrollbar()
Example #22
Source File: gui_widgets.py From SVPV with MIT License | 5 votes |
def __init__(self, parent): tk.LabelFrame.__init__(self, parent, text="Plot Custom Range") self.parent = parent self.lab = tk.Label(self, text='Custom range:') self.rangeVar = tk.StringVar(value='chrX:YYYYYY-ZZZZZZ') self.entry = tk.Entry(self, textvariable=self.rangeVar, width=25) self.setter = tk.Button(self, text="Plot Custom", command=self.do_plot) self.lab.grid(row=0, column=0, sticky=tk.NSEW) self.entry.grid(row=0, column=1, sticky=tk.NSEW) self.setter.grid(row=0, column=2, sticky=tk.NSEW)
Example #23
Source File: config_ui.py From thonny with MIT License | 5 votes |
def __init__(self, master, page_records): super().__init__(master) width = ems_to_pixels(53) height = ems_to_pixels(43) self.geometry("%dx%d" % (width, height)) self.title(_("Thonny options")) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) main_frame = ttk.Frame(self) # otherwise there is wrong color background with clam main_frame.grid(row=0, column=0, sticky=tk.NSEW) main_frame.columnconfigure(0, weight=1) main_frame.rowconfigure(0, weight=1) self._notebook = ttk.Notebook(main_frame) self._notebook.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW, padx=10, pady=10) self._ok_button = ttk.Button(main_frame, text=_("OK"), command=self._ok, default="active") self._cancel_button = ttk.Button(main_frame, text=_("Cancel"), command=self._cancel) self._ok_button.grid(row=1, column=1, padx=(0, 11), pady=(0, 10)) self._cancel_button.grid(row=1, column=2, padx=(0, 11), pady=(0, 10)) self._page_records = [] for key, title, page_class, order in sorted(page_records, key=lambda r: (r[3], r[0])): try: spacer = ttk.Frame(self) spacer.rowconfigure(0, weight=1) spacer.columnconfigure(0, weight=1) page = page_class(spacer) page.key = key self._page_records.append((key, title, page)) page.grid(sticky=tk.NSEW, pady=(15, 10), padx=15) self._notebook.add(spacer, text=title) except Exception: traceback.print_exc() self.bind("<Return>", self._ok, True) self.bind("<Escape>", self._cancel, True) self._notebook.select(self._notebook.tabs()[ConfigurationDialog.last_shown_tab_index])
Example #24
Source File: workbench.py From thonny with MIT License | 5 votes |
def _maximize_view(self, event=None) -> None: if self._maximized_view is not None: return # find the widget that can be relocated widget = self.focus_get() if isinstance(widget, (EditorNotebook, AutomaticNotebook)): current_tab = widget.get_current_child() if current_tab is None: return if not hasattr(current_tab, "maximizable_widget"): return widget = current_tab.maximizable_widget while widget is not None: if hasattr(widget, "home_widget"): # if widget is view, then widget.master is workbench widget.grid( row=1, column=0, sticky=tk.NSEW, in_=widget.master # type: ignore ) # hide main_frame self._main_frame.grid_forget() self._maximized_view = widget self.get_variable("view.maximize_view").set(True) break else: widget = widget.master # type: ignore
Example #25
Source File: workbench.py From thonny with MIT License | 5 votes |
def _unmaximize_view(self, event=None) -> None: if self._maximized_view is None: return # restore main_frame self._main_frame.grid(row=1, column=0, sticky=tk.NSEW, in_=self) # put the maximized view back to its home_widget self._maximized_view.grid( row=0, column=0, sticky=tk.NSEW, in_=self._maximized_view.home_widget # type: ignore ) self._maximized_view = None self.get_variable("view.maximize_view").set(False)
Example #26
Source File: workbench.py From thonny with MIT License | 5 votes |
def _on_configure(self, event) -> None: # called when window is moved or resized if ( hasattr(self, "_maximized_view") # configure may happen before the attribute is defined and self._maximized_view # type: ignore ): # grid again, otherwise it acts weird self._maximized_view.grid( row=1, column=0, sticky=tk.NSEW, in_=self._maximized_view.master # type: ignore )
Example #27
Source File: gui.py From SVPV with MIT License | 5 votes |
def set_sv_chooser(self): if self.sv_chooser: self.sv_chooser.destroy() self.sv_chooser = gw.SvChooser(self, self.svs, self.par.run.vcf.count) self.sv_chooser.grid(row=5, column=0, sticky=tk.NSEW, padx=10, columnspan=2)
Example #28
Source File: gui.py From ib-historical-data with GNU General Public License v3.0 | 5 votes |
def __init__(self, master, row, text, default, onChange): self.lbl = ttk.Label(master, text=text) self.entry = addvar(ttk.Entry(master), onChange, default) self.lbl.grid(row=row, column=0, sticky=tki.NW) self.entry.grid(row=row, column=1, columnspan=2, sticky=tki.NSEW)
Example #29
Source File: gui.py From ib-historical-data with GNU General Public License v3.0 | 5 votes |
def __init__(self, master, row, text, default=''): self.lbl = ttk.Label(master, text=text) self.entry = ttk.Label(master) self.lbl.grid(row=row, column=0, sticky=tki.NW) self.entry.grid(row=row, column=1, columnspan=2, sticky=tki.NSEW) self.value = default
Example #30
Source File: gui.py From ib-historical-data with GNU General Public License v3.0 | 5 votes |
def __init__(self, master, row, text, default='/'): self.lbl = ttk.Label(master, text=text) self.entry = ttk.Entry(master) self.btn = ttk.Button(master, text='...', command=self._onSelectPath) self.lbl.grid(row=row, column=0, sticky=tki.NW) self.entry.grid(row=row, column=1, sticky=tki.NSEW) self.btn.grid(row=row, column=2, sticky=tki.NSEW) self.value = default