Python tkinter.Widget() Examples
The following are 30
code examples of tkinter.Widget().
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: ttk.py From ironpython3 with Apache License 2.0 | 6 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Treeview with parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand, yscrollcommand WIDGET-SPECIFIC OPTIONS columns, displaycolumns, height, padding, selectmode, show ITEM OPTIONS text, image, values, open, tags TAG OPTIONS foreground, background, font, image """ Widget.__init__(self, master, "ttk::treeview", kw)
Example #2
Source File: ttk.py From ironpython3 with Apache License 2.0 | 6 votes |
def __init__(self, master, widgetname, kw=None): """Constructs a Ttk Widget with the parent master. STANDARD OPTIONS class, cursor, takefocus, style SCROLLABLE WIDGET OPTIONS xscrollcommand, yscrollcommand LABEL WIDGET OPTIONS text, textvariable, underline, image, compound, width WIDGET STATES active, disabled, focus, pressed, selected, background, readonly, alternate, invalid """ master = setup_master(master) if not getattr(master, '_tile_loaded', False): # Load tile now, if needed _load_tile(master) tkinter.Widget.__init__(self, master, widgetname, kw=kw)
Example #3
Source File: ttk.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, widget=None, **kw): """Constructs a Ttk Entry widget with the parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand WIDGET-SPECIFIC OPTIONS exportselection, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width VALIDATION MODES none, key, focus, focusin, focusout, all """ Widget.__init__(self, master, widget or "ttk::entry", kw)
Example #4
Source File: ttk.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, widgetname, kw=None): """Constructs a Ttk Widget with the parent master. STANDARD OPTIONS class, cursor, takefocus, style SCROLLABLE WIDGET OPTIONS xscrollcommand, yscrollcommand LABEL WIDGET OPTIONS text, textvariable, underline, image, compound, width WIDGET STATES active, disabled, focus, pressed, selected, background, readonly, alternate, invalid """ master = setup_master(master) if not getattr(master, '_tile_loaded', False): # Load tile now, if needed _load_tile(master) tkinter.Widget.__init__(self, master, widgetname, kw=kw)
Example #5
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Panedwindow with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, width, height PANE OPTIONS weight """ Widget.__init__(self, master, "ttk::panedwindow", kw)
Example #6
Source File: ui_utils.py From thonny with MIT License | 6 votes |
def insert(self, pos, child, **kw): kw.setdefault("minsize", self._pane_minsize) if pos == "auto": # According to documentation I should use self.panes() # but this doesn't return expected widgets for sibling in sorted( self.pane_widgets(), key=lambda p: p.position_key if hasattr(p, "position_key") else 0, ): if ( not hasattr(sibling, "position_key") or sibling.position_key == None or sibling.position_key > child.position_key ): pos = sibling break else: pos = "end" if isinstance(pos, tk.Widget): kw["before"] = pos self.add(child, **kw)
Example #7
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, widgetname, kw=None): """Constructs a Ttk Widget with the parent master. STANDARD OPTIONS class, cursor, takefocus, style SCROLLABLE WIDGET OPTIONS xscrollcommand, yscrollcommand LABEL WIDGET OPTIONS text, textvariable, underline, image, compound, width WIDGET STATES active, disabled, focus, pressed, selected, background, readonly, alternate, invalid """ master = setup_master(master) if not getattr(master, '_tile_loaded', False): # Load tile now, if needed _load_tile(master) tkinter.Widget.__init__(self, master, widgetname, kw=kw)
Example #8
Source File: ttk.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Panedwindow with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, width, height PANE OPTIONS weight """ Widget.__init__(self, master, "ttk::panedwindow", kw)
Example #9
Source File: ttk.py From ironpython3 with Apache License 2.0 | 6 votes |
def __init__(self, master=None, widget=None, **kw): """Constructs a Ttk Entry widget with the parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand WIDGET-SPECIFIC OPTIONS exportselection, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width VALIDATION MODES none, key, focus, focusin, focusout, all """ Widget.__init__(self, master, widget or "ttk::entry", kw)
Example #10
Source File: ttk.py From ironpython3 with Apache License 2.0 | 6 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Panedwindow with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, width, height PANE OPTIONS weight """ Widget.__init__(self, master, "ttk::panedwindow", kw)
Example #11
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Treeview with parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand, yscrollcommand WIDGET-SPECIFIC OPTIONS columns, displaycolumns, height, padding, selectmode, show ITEM OPTIONS text, image, values, open, tags TAG OPTIONS foreground, background, font, image """ Widget.__init__(self, master, "ttk::treeview", kw)
Example #12
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, widget=None, **kw): """Constructs a Ttk Entry widget with the parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand WIDGET-SPECIFIC OPTIONS exportselection, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width VALIDATION MODES none, key, focus, focusin, focusout, all """ Widget.__init__(self, master, widget or "ttk::entry", kw)
Example #13
Source File: ttk.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Treeview with parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand, yscrollcommand WIDGET-SPECIFIC OPTIONS columns, displaycolumns, height, padding, selectmode, show ITEM OPTIONS text, image, values, open, tags TAG OPTIONS foreground, background, font, image """ Widget.__init__(self, master, "ttk::treeview", kw)
Example #14
Source File: workbench.py From thonny with MIT License | 5 votes |
def _init_configuration(self) -> None: self._configuration_manager = try_load_configuration(thonny.CONFIGURATION_FILE) self._configuration_pages = [] # type: List[Tuple[str, str, Type[tk.Widget]] self.set_default("general.single_instance", thonny.SINGLE_INSTANCE_DEFAULT) self.set_default("general.ui_mode", "simple" if running_on_rpi() else "regular") self.set_default("general.debug_mode", False) self.set_default("general.disable_notification_sound", False) self.set_default("general.scaling", "default") self.set_default("general.language", languages.BASE_LANGUAGE_CODE) self.set_default("general.font_scaling_mode", "default") self.set_default("run.working_directory", os.path.expanduser("~"))
Example #15
Source File: workbench.py From thonny with MIT License | 5 votes |
def add_configuration_page( self, key: str, title: str, page_class: Type[tk.Widget], order: int ) -> None: self._configuration_pages.append((key, title, page_class, order))
Example #16
Source File: tix.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __getitem__(self,key): return self.tk.call(self.stylename, 'cget', '-%s'%key) ###################################################### ### The Tix Widget classes - in alphabetical order ### ######################################################
Example #17
Source File: support.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def widget_eq(actual, expected): if actual == expected: return True if isinstance(actual, (str, tkinter.Widget)): if isinstance(expected, (str, tkinter.Widget)): return str(actual) == str(expected) return False
Example #18
Source File: ui_utils.py From thonny with MIT License | 5 votes |
def pane_widgets(self): result = [] for pane in self.panes(): # pane is not the widget but some kind of reference object assert not isinstance(pane, tk.Widget) result.append(self.nametowidget(str(pane))) return result
Example #19
Source File: workbench.py From thonny with MIT License | 5 votes |
def show_view(self, view_id: str, set_focus: bool = True) -> Union[bool, tk.Widget]: """View must be already registered. Args: view_id: View class name without package name (eg. 'ShellView') """ if view_id == "MainFileBrowser": # Was renamed in 3.1.1 view_id = "FilesView" # NB! Don't forget that view.home_widget is added to notebook, not view directly # get or create view = self.get_view(view_id) notebook = view.home_widget.master # type: ignore if hasattr(view, "before_show") and view.before_show() == False: # type: ignore return False if view.hidden: # type: ignore notebook.insert( "auto", view.home_widget, # type: ignore text=self._view_records[view_id]["label"], ) view.hidden = False # type: ignore if hasattr(view, "on_show"): # type: ignore view.on_show() # switch to the tab notebook.select(view.home_widget) # type: ignore # add focus if set_focus: view.focus_set() self.set_option("view." + view_id + ".visible", True) self.event_generate("ShowView", view=view, view_id=view_id) return view
Example #20
Source File: workbench.py From thonny with MIT License | 5 votes |
def focus_get(self) -> Optional[tk.Widget]: try: return tk.Tk.focus_get(self) except Exception: # This may give error in Ubuntu return None
Example #21
Source File: tix.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def _subwidget_name(self,name): """Get a subwidget name (returns a String, not a Widget !)""" try: return self.tk.call(self._w, 'subwidget', name) except TclError: return None
Example #22
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Radiobutton with parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS command, value, variable """ Widget.__init__(self, master, "ttk::radiobutton", kw)
Example #23
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Labelframe with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS labelanchor, text, underline, padding, labelwidget, width, height """ Widget.__init__(self, master, "ttk::labelframe", kw)
Example #24
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Label with parent master. STANDARD OPTIONS class, compound, cursor, image, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS anchor, background, font, foreground, justify, padding, relief, text, wraplength """ Widget.__init__(self, master, "ttk::label", kw)
Example #25
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Checkbutton widget with the parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS command, offvalue, onvalue, variable """ Widget.__init__(self, master, "ttk::checkbutton", kw)
Example #26
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Button widget with the parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS command, default, width """ Widget.__init__(self, master, "ttk::button", kw)
Example #27
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def state(self, statespec=None): """Modify or inquire widget state. Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed. statespec is expected to be a sequence.""" if statespec is not None: statespec = ' '.join(statespec) return self.tk.splitlist(str(self.tk.call(self._w, "state", statespec)))
Example #28
Source File: support.py From ironpython3 with Apache License 2.0 | 5 votes |
def widget_eq(actual, expected): if actual == expected: return True if isinstance(actual, (str, tkinter.Widget)): if isinstance(expected, (str, tkinter.Widget)): return str(actual) == str(expected) return False
Example #29
Source File: tix.py From ironpython3 with Apache License 2.0 | 5 votes |
def __getitem__(self,key): return self.tk.call(self.stylename, 'cget', '-%s'%key) ###################################################### ### The Tix Widget classes - in alphabetical order ### ######################################################
Example #30
Source File: tix.py From ironpython3 with Apache License 2.0 | 5 votes |
def _subwidget_name(self,name): """Get a subwidget name (returns a String, not a Widget !)""" try: return self.tk.call(self._w, 'subwidget', name) except TclError: return None