Skip to main content

Themes don't have to be hard.

Project description

py_simple_ttk 0.1.10

Themes don't have to be hard.


About^

py_simple_ttk exists because I got tired of rewriting the same code over and over for simple projects. The goal is to provide a variety of meta widgets with consistent get/set/enable/disable/destroy methods and mega-widgets that make ttk development easier and faster. Features include built-in theme support, a score of labeled and multi-widgets, tools for easy form building, a sample application demonstrating many of py_simple_ttk's features, a configuration file system, and much more. Lines of code

Requirements^

Configuring ini.json^

+--------------------+-------------------------------------------+
|        Key         |                   Value                   |
+--------------------+-------------------------------------------+
| application        | Application Name (String)                 |
| version            | Application Version (String)              |
| icon               | Application Icon Path (String)            |
| width              | Startup Window Width (Int)                |
| height             | Startup Window Height (Int)               |
| minwidth           | Window Minimum Width (Int)                |
| minheight          | Window Minimum Height (Int)               |
| scaling            | Window Scaling (Float)                    |
| scale_minsize      | Scale application Minimum Size (Boolean)  |
| scale_startsize    | Scale application Start Size (Boolean)    |
| resizable_width    | Enable Window Width Resizing (Boolean)    |
| resizable_height   | Enable Window Height Resizing (Boolean)   |
| start_maximized    | Start Window Maximized (Boolean)          |
| enable_maximized   | Enable Window Maximized (Boolean)         |
| start_fullscreen   | Start Window in Fullscreen mode (Boolean) |
| enable_fullscreen  | Enable Window Fullscreen option (Boolean) |
| enable_themes_menu | Enable Themes Dropdown (Boolean)          |
| movable_tabs       | Enable Moveable Notebook Tabs (Boolean)   |
| enable_users       | Enable a User Profiles System             |
+--------------------+-------------------------------------------+

Widgets^

Button Widgets^

LabeledButton^

Labeled Button widget

class LabeledButton(Labeler, Button):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, is_child: bool = False, command=None, **kw):
		...
	def clear(self) -> None:
		"""Set button text to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get(self) -> str:
		"""Get button text"""
	def set(self, val: str) -> None:
		"""Set button text"""

Core Functions^

py_simple_ttk.widgets.WidgetsCore.bbox_to_width_and_height^

Takes a bbox and converts it to a width and height tuple.

</code></pre>
</blockquote>
<p>def bbox_to_width_and_height(bbox: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.center_window^

Centers spawn window on main window. Call win.update_idletasks() on either window before calling this if said window is not yet shown.

</code></pre>
</blockquote>
<p>def center_window(main_window: tkinter.Tk, spawn_window: tkinter.Toplevel):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.check_in_bounds^

Checks if a position is within a given bounds. Pos is generally a mouse event position tuple, bounds is generally a canvas.bbox(), but a (left, top, right, bottom) tuple will work too.

</code></pre>
</blockquote>
<p>def check_in_bounds(pos: tuple, bounds: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.complex_widget_search^

A more robust version of the widget search with lists for multiple widget types found in one go

</code></pre>
</blockquote>
<p>def complex_widget_search(node_widget, widget_types_to_find: list, found_lists={}):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.copy_to_user_clipboard^

Copies a string to the user's clipboard.

</code></pre>
</blockquote>
<p>def copy_to_user_clipboard(widget, value):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.create_round_rectangle^

Draws a rounded rectangle of a given radius on a tk.canvas

</code></pre>
</blockquote>
<p>def create_round_rectangle(canvas, x1, y1, x2, y2, r=20, fill='', outline='#000000', **kwargs):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.default_pack^

Apply a consistent descending packing method.

</code></pre>
</blockquote>
<p>def default_pack(widget, bottom: bool = False, padx=5):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.default_separator^

Apply a consistent horizontal separator.

</code></pre>
</blockquote>
<p>def default_separator(f: tkinter.ttk.Frame, padx: int = 35, pady=(10, 5)):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.default_vertical_pack^

Apply a consistent packing method to vertically packed widgets.

</code></pre>
</blockquote>
<p>def default_vertical_pack(widget, expand: bool = False, fill: str = 'both', padx: int = 0):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.default_vertical_separator^

Apply a consistent vertical separator.

</code></pre>
</blockquote>
<p>def default_vertical_separator(frame: tkinter.ttk.Frame, pady: int = 15, padx: int = 10):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.enable_notebook_movement^

Copyright CJB 2010-07-31: https://wiki.tcl-lang.org/page/Drag+and+Drop+Notebook+Tabs Enables Tab dragging in subsequently created notebooks. Only run this function once.

</code></pre>
</blockquote>
<p>def enable_notebook_movement(app):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.focus_next^

Forces focus to the widget after the one that triggered the event

</code></pre>
</blockquote>
<p>def focus_next(event):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.force_aspect^

Forces an inner frame to maintain an aspect ratio regardless of the outer frame's size

</code></pre>
</blockquote>
<p>def force_aspect(inner_frame: tkinter.ttk.Frame, outer_frame: tkinter.ttk.Frame, ratio=1.7777777777777777):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.get_asset^

Gets an asset from the included assets folder by relative path

</code></pre>
</blockquote>
<p>def get_asset(path, folder='C:\Users\arcti\github\py_simple_ttk\py_simple_ttk\./assets'):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.get_bundled_themes_list^

None

</code></pre>
</blockquote>
<p>def get_bundled_themes_list(verbose=False):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.get_generated_font_images_lookup^

Makes a lookup for the pre-generated open-sans font monograms that ship with py_simple_ttk.

</code></pre>
</blockquote>
<p>def get_generated_font_images_lookup(path=None):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.get_local_appdata_folder^

Opens user's Windows home folder. Only works on Windows for obvious reasons.

</code></pre>
</blockquote>
<p>def get_local_appdata_folder():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.get_themes_folder^

Gets the absolute path to the included themes folder

</code></pre>
</blockquote>
<p>def get_themes_folder():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.open_link^

Opens a link in the user's default web browser. Returns None

</code></pre>
</blockquote>
<p>def open_link(link: str):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.recursive_widget_search^

Adds widgets of a given type to a list as it travels up, away from the root of a widget tree. This method can be slow on large widget trees but is useful for retheming tk widgets with ttk formatting on theme changes. Returns a list of widgets

</code></pre>
</blockquote>
<p>def recursive_widget_search(node_widget, widget_type_to_find, found_list=[]):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.widgets.WidgetsCore.run_cl^

Runs something via command line. Returns None

</code></pre>
</blockquote>
<p>def run_cl(commands: list):</p>
<blockquote>
<p>...</p>
<pre><code>

Core Widgets^

py_simple_ttk.widgets.MultiWidget.MultiWidgetMixin^

An abstract mixin that provides a way to easily instantiate multiple of the same class of a widget and making complicated forms with simple get/set methods.

MultiWidgets support a simple get/set system. Calling get without a configuration list returns a dict of subwidget keys mapped to the values of each subwidget's .get value. Passing a list of subwidget keys limits MultiWidgetMixin.get to said subwidgets. Subclassing a multiwidget with one or more instances of one class and then calling multiwidget.add() with different classes after is acceptable assuming the widget supports being added and .get / .set / .enable / .disable / .clear methods.

class MultiWidgetMixin(object):
	def __init__(self, widget_type, config: dict):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

py_simple_ttk.widgets.WidgetsCore.SuperWidgetMixin^

Mixin to easily bind many of the common tkinter events.

This class serves to add bindings for the majority of common tkinter widget events. The bindings are made in add mode to prevent previous / new bindings from causing unintended side-effects.

class SuperWidgetMixin(object):
	def __init__(self, on_mouse_enter=None, on_mouse_leave=None, on_mouse_move=None, on_mouse_wheel=None, on_left_click=None, on_middle_click=None, on_right_click=None, on_configure=None, bind_mouse_scroll=False):
		...

Tabs^

py_simple_ttk.widgets.Tabs.Tab^

The core Tab class.

The notebook object can be any ttk.Notebook, automatically adds itself to its parent notebook with title being the tab label. This class may be instantiated directly and added to or subclassed based on need.

class Tab(Frame):
	def __init__(self, notebook: tkinter.ttk.Notebook, title: str):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.Tabs.LauncherTab^

Basic Tab for launching tasks from a list.

Performs an action on a list of options. The options argument is formatted as such: options = {"Button Text 1": val1,"Button Text 2": val2} Button presses will call action(val)

class LauncherTab(Tab):
	def __init__(self, notebook: tkinter.ttk.Notebook, title: str, options: dict, action: Callable):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.Tabs.BrowserLauncherTab^

LauncherTab that opens a list of URLS/Files

Takes a dict of button texts as keys and urls to open as values

class BrowserLauncherTab(LauncherTab):
	def __init__(self, notebook: tkinter.ttk.Notebook, title: str, options: dict):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.Tabs.CommandLauncherTab^

LauncherTab that runs a list of commands

Takes a dict of button texts as keys and command prompt commands to execute as values

class CommandLauncherTab(LauncherTab):
	def __init__(self, notebook: tkinter.ttk.Notebook, title: str, options: dict):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.Tabs.ConsoleTab^

Basic console tab using a ConsoleWidget

class ConsoleTab(Tab):
	def __init__(self, notebook: tkinter.ttk.Notebook, **kwargs):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.Tabs.TableTab^

Basic Table Tab

table_contents is a dictionary whose keys map to lists with the column contents

class TableTab(Tab):
	def __init__(self, notebook: tkinter.ttk.Notebook, title: str, table_contents: dict, **kw):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.Tabs.TreeTableTab^

Improved Table Tab

table_contents is a dictionary whose keys map to list with the column contents

class TreeTableTab(Tab):
	def __init__(self, notebook: tkinter.ttk.Notebook, title: str, table_contents: dict = {}, **kw):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

Canvas Widgets^

py_simple_ttk.widgets.ResizableCanvas.ResizableCanvas^

Resizeable Canvas

Canvas resizes to fit frame on configure event.

class ResizableCanvas(Canvas):
	def __init__(self, parent, **kw):
		...
	def create_arc(self, *args, **kw):
		"""Create arc shaped region with coordinates x1,y1,x2,y2."""
	def create_bitmap(self, *args, **kw):
		"""Create bitmap with coordinates x1,y1."""
	def create_image(self, *args, **kw):
		"""Create image item with coordinates x1,y1."""
	def create_line(self, *args, **kw):
		"""Create line with coordinates x1,y1,...,xn,yn."""
	def create_oval(self, *args, **kw):
		"""Create oval with coordinates x1,y1,x2,y2."""
	def create_polygon(self, *args, **kw):
		"""Create polygon with coordinates x1,y1,...,xn,yn."""
	def create_rectangle(self, *args, **kw):
		"""Create rectangle with coordinates x1,y1,x2,y2."""
	def create_round_rectangle(self, x1: float, y1: float, x2: float, y2: float, r: float = 20, fill: str = '', outline: str = '#000000', **kwargs):
		"""Draws a rounded rectangle of a given radius on a tk.canvas."""
	def create_text(self, *args, **kw):
		"""Create text with coordinates x1,y1."""
	def create_window(self, *args, **kw):
		"""Create window with coordinates x1,y1,x2,y2."""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def refresh(self):
		"""Refresh Canvas"""

py_simple_ttk.widgets.ScrolledCanvas.ScrolledCanvas^

Resizeable, Auto-Scrollbarred Canvas

Canvas resizes to fit frame on configure event. Canvas has automatic Scrollbars that appear when needed. Canvas background color is based on current theme. Due to how the scrolling is handled the actual Canvas is accessd via ScrolledCanvas().canvas.

class ScrolledCanvas(Frame):
	def __init__(self, parent, on_mouse_enter=None, on_mouse_leave=None, on_mouse_move=None, on_mouse_wheel=None, on_left_click=None, on_middle_click=None, on_right_click=None, on_configure=None, bind_canvas_scroll=True, **kw):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get_adjusted_y_view(self, event):
		"""Gets a canvas y-view adjusted based on its scrolled position"""
	def use_style(self, style):
		"""Reformat with a given ttk style. `Returns None`"""

py_simple_ttk.widgets.ScrolledCanvas.TiledCanvas^

class TiledCanvas(ScrolledCanvas):
	def __init__(self, *args, tile_width=400, tile_height=100, tile_padx=5, tile_pady=5, tile_color='#424548', text_color='#CCCCCC', border_color='#000000', on_tile_left_click=None, on_tile_middle_click=None, on_tile_right_click=None, override_tile_width=False, **kw):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get_adjusted_y_view(self, event):
		"""Gets a canvas y-view adjusted based on its scrolled position"""
	def refresh(self, event=None):
		"""Redraw the canvas"""
	def use_style(self, style):
		"""Reformat with a given ttk style. `Returns None`"""

py_simple_ttk.widgets.ScrolledCanvas.ExampleTile^

An example tile for a Scrolled Canvas

class ExampleTile(object):
	def __init__(self, manager, text):
		...
	def activate(self):
		"""Calls the manager to activate the widget."""
	def deactivate(self):
		"""Calls the manager to deactivate the widget."""
	def is_in_range(self, pointer_x, pointer_y):
		"""Checks if the mouse pointer is in the tile."""
	def set_position(self, x, y):
		"""Sets a tiles position for the draw manager's draw method."""

Checkbutton Widgets^

py_simple_ttk.widgets.CheckbuttonWidgets.LabeledCheckbutton^

Labeled Checkbutton

The "replace_output" keyword argument allows the user to provide a tuple of len 2 to replace the default True/False return values. The "is_child" keyword is used by the multiwidget mixin for label configuration and should probably be left alone unless you are making your own multiwidgets.

class LabeledCheckbutton(Labeler, Checkbutton):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str = '', replace_output: list = None, default: bool = False, is_child: bool = False, **kw):
		...
	def clear(self):
		"""Sets the Checkbutton to its default value, usually *False* `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Disable Checkbutton. `Returns None`"""
	def enable(self):
		"""Enable Checkbutton. `Returns None`"""
	def get(self):
		"""Get Checkbutton value. `Returns a Boolean unless replace_output is set`"""
	def set(self, val: bool):
		"""Set Checkbutton value. `Returns None`"""

py_simple_ttk.widgets.CheckbuttonWidgets.LabeledMultiCheckbutton^

Labeled MultiWidget LabeledCheckbutton.

Used when you need multiple, vertically stacked Labeled Checkbuttons

class LabeledMultiCheckbutton(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top'):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

Combobox Widgets^

py_simple_ttk.widgets.ComboboxWidgets.LabeledCombobox^

Labeled Combobox with the Super Widget mixin

Set custom_values keyword to "False" to disable custom user-entered values. Set the "default" keyword to the index of the value to display by default from the "values" keyword.

class LabeledCombobox(Labeler, Combobox, SuperWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, command: Callable = None, default: int = 0, on_keystroke: bool = False, bind_enter: bool = True, bind_escape_clear: bool = True, values: list = (), custom_values: bool = True, labelside: str = 'left', is_child: bool = False, min_width: int = 0, widgetargs={}, **kw):
		...
	def clear(self):
		"""Sets Combobox to its default value. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Disable Combobox. `Returns None`"""
	def enable(self):
		"""Enable Combobox. `Returns None`"""
	def get(self):
		"""Get Combobox value. `Returns a String`"""
	def set(self, val: str):
		"""Set Combobox value. `Returns None`"""

py_simple_ttk.widgets.ComboboxWidgets.LabeledMultiCombobox^

Labeled MultiWidget LabeledCombobox

Used when you need mutiple, vertically stacked Labeled Comboboxes

class LabeledMultiCombobox(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top'):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

Console Widgets^

py_simple_ttk.widgets.ConsoleWidgets.ConsoleWidget^

Set labeltext, even if temporarily at init or the label widget will be ignored

Used when you need to drop a console interface into an application. To write to the console call console.print(value). Pass a function as the "command" keyword argument to handle the entry input.

class ConsoleWidget(Labeler, Frame):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str = 'Console: ', entrylabeltext: str = 'Command: ', labelside: str = 'top', button_text: str = 'Run', is_child: bool = False, **kwargs):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def print(self, val, end: str = '\n'):
		"""Prints a line to the console with a customizable line ending. `Returns None`"""

Entry Widgets^

py_simple_ttk.widgets.EntryWidgets.ScrolledEntry^

Scrolled ttk.Entry with SuperWidgetMixin

This class is here for completeness but most of the time you will want to use the ScrolledText widget. Used when you need a scrollable text entry box.

class ScrolledEntry(Scroller, Entry, SuperWidgetMixin):
	def __init__(self, parent, **kw):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get(self):
		"""Return the text."""

py_simple_ttk.widgets.EntryWidgets.LabeledEntry^

Labeled ttk.Entry with SuperWidgetMixin

Used when you need a Labeled Entry

class LabeledEntry(Labeler, Entry, SuperWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, command: Callable = None, default: str = '', on_keystroke: bool = False, bind_enter: bool = True, bind_escape_clear: bool = True, is_child: bool = False, min_width: int = 0, widgetargs={}, **kw):
		...
	def clear(self):
		"""Set Entry value to default, empty unless default set. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Disable Entry. `Returns None`"""
	def enable(self):
		"""Enable Entry. `Returns None`"""
	def get(self):
		"""Get Entry value. `Returns a String`"""
	def set(self, val):
		"""Set Entry value. `Returns None`"""

py_simple_ttk.widgets.EntryWidgets.LabeledMultiEntry^

Labeled MultiWidget LabeledEntry

Used when you need multiple, vertically stacked Labeled Entries

class LabeledMultiEntry(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top'):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

py_simple_ttk.widgets.EntryWidgets.LabeledButtonEntry^

LabeledEntry with a ttk.Button on the right

class LabeledButtonEntry(LabeledEntry):
	def __init__(self, *args, button_text='', **kwargs):
		...
	def clear(self):
		"""Set Entry value to default, empty unless default set. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Disable Entry. `Returns None`"""
	def enable(self):
		"""Enable Entry. `Returns None`"""
	def get(self):
		"""Get Entry value. `Returns a String`"""
	def set(self, val):
		"""Set Entry value. `Returns None`"""

py_simple_ttk.widgets.EntryWidgets.LabeledMultiButtonEntry^

Labeled MultiWidget LabeledEntry

Used when you need multiple, vertically stacked Labeled Button Entries

class LabeledMultiButtonEntry(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top'):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

py_simple_ttk.widgets.EntryWidgets.LabeledPathEntry^

LabeledEntry with a ttk.Button bound to a file- or folder-picker for easy system path selection. Defaults to tk.filedialog.askopenfilename if no tk.filedialog specified.

class LabeledPathEntry(LabeledEntry):
	def __init__(self, *args, button_text: str = '...', dialog: None, dialog_args: dict = {}, **kwargs):
		...
	def clear(self):
		"""Set Entry value to default, empty unless default set. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Disable Entry. `Returns None`"""
	def enable(self):
		"""Enable Entry. `Returns None`"""
	def get(self):
		"""Get Entry value. `Returns a String`"""
	def set(self, val):
		"""Set Entry value. `Returns None`"""

py_simple_ttk.widgets.EntryWidgets.PasswordEntry^

Username / Password Entry

A username/password entry widget with optional password peeking. Set password_char to '' to show password by default. The provided command will always be called with the tuple (username_entry.get(), password_entry.get()) as the only argument even if one of the entries is disabled.

class PasswordEntry(Frame):
	def __init__(self, *args, instruction_text: str = '', username_text: str = 'Username: ', username_enabled: bool = True, password_text: str = 'Password: ', password_enabled: bool = True, button_text: str = 'Submit', command=<built-in function print>, password_char: str = '*', peek_enabled: bool = True, invert_peek_colors: bool = False, **kwargs):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def on_peek_press(self, event=None):
		"""Show the contents of the password entry while it is being pressed"""
	def on_peek_release(self, event=None):
		"""Rehide the contents of the password entry"""
	def on_submit(self, event=None):
		"""Calls the provided "command" function with the contents of the entry box. `Returns None`"""

KeyPad Widgets^

py_simple_ttk.widgets.KeyPadWidgets.KeypadButton^

Base Keypad Button

Keypad button that automatically packs itself based on given coordinates. This object is not usually directly instantiated.

class KeypadButton(Button):
	def __init__(self, frame, value, coords, callback):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.KeyPadWidgets.BaseKeypad^

Base Keypad Class

Either instantiate directly with a custom layout or subclass with each subclass supplying a custom layout for more keypads. Subclass KeypadButton and supply the class as the "button_type" kwarg for custom buttons.

class BaseKeypad(Frame):
	def __init__(self, layout, callback, button_class=<class 'py_simple_ttk.widgets.KeyPadWidgets.KeypadButton'>, *args, **kwargs):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

py_simple_ttk.widgets.KeyPadWidgets.DialerKeypad^

Phone Dialer Keypad

Example 12-button keypad, subclass BaseKeypad and supply a custom layout for more keypads.

class DialerKeypad(BaseKeypad):
	def __init__(self, callback, *args, **kwargs):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

Labeler Widget^

LabeledButton^

Labeled Button widget

class LabeledButton(Labeler, Button):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, is_child: bool = False, command=None, **kw):
		...
	def clear(self) -> None:
		"""Set button text to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get(self) -> str:
		"""Get button text"""
	def set(self, val: str) -> None:
		"""Set button text"""

ListBox Widgets^

py_simple_ttk.widgets.ListBoxWidgets.ScrolledListBox^

Scrolled Listbox with SuperWidget mixin

class ScrolledListBox(Scroller, Listbox, SuperWidgetMixin):
	def __init__(self, parent, **kw):
		...
	def activate(self, index):
		"""Activate item identified by INDEX."""
	def curselection(self):
		"""Return the indices of currently selected item."""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get(self, first, last=None):
		"""Get list of items from FIRST to LAST (included)."""

py_simple_ttk.widgets.ListBoxWidgets.Table^

Listboxes bound to scroll in union. Additional bindings will be needed in order to handle clicking.

Tested on Mac/Windows/Linux. In most cases a TreeTable widget will be superior to this.

class Table(Frame):
	def __init__(self, *args, min_column_width: int = 100, start_column_width: int = 100, on_selection=None, visible_rows=0, **kw):
		...
	def build(self, contents: dict):
		"""Rebuild the table"""
	def clear(self):
		"""Clears the table"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def get(self):
		"""Gets the currently selected items from the table. `Returns a List of Strings`"""
	def use_style(self, style: tkinter.ttk.Style):
		"""Update to match supplied ttk.Style object. `Returns None`"""

OptionMenu Widgets^

py_simple_ttk.widgets.OptionMenuWidgets.LabeledOptionMenu^

Labeled OptionMenu widget

class LabeledOptionMenu(Labeler, OptionMenu):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, options: list, default: int = 0, is_child: bool = False):
		...
	def clear(self):
		"""Sets OptionMenu to its default value. `Returns None`"""
	def destroy(self):
		"""Destroy this widget and its associated variable."""
	def disable(self):
		"""Disable OptionMenu. `Returns None`"""
	def enable(self):
		"""Enable OptionMenu. `Returns None`"""
	def get(self):
		"""Get OptionMenu value. `Returns a String`"""
	def set(self, val):
		"""Set OptionMenu value. `Returns None`"""
	def set_menu(self, default=None, *values):
		"""Build a new menu of radiobuttons with *values and optionally
        a default value."""

py_simple_ttk.widgets.OptionMenuWidgets.LabeledMultiOptionMenu^

Labeled MultiWidget LabeledOptionMenu

class LabeledMultiOptionMenu(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top'):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

ProgressBar Widgets^

py_simple_ttk.widgets.ProgressbarWidgets.LabeledProgressbar^

Labeled Progressbar

class LabeledProgressbar(Labeler, Progressbar):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, orient='horizontal', labelside='left', is_child=False, default: float = 0, **kw):
		...
	def clear(self):
		"""Sets Progresbar progress to its default value `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Enable Progresbar. `Returns None`"""
	def enable(self):
		"""Disable Progresbar. `Returns None`"""
	def get(self):
		"""Set Progresbar progress. `Returns None`"""
	def link(self, widget):
		"""Easily link to other widgets, sets the progressbar var to the passed widget's var. `Returns None`"""
	def set(self, val):
		"""Get Progresbar progress. `Returns a String`"""
	def start(self, interval=None):
		"""Begin autoincrement mode: schedules a recurring timer event
        that calls method step every interval milliseconds.

        interval defaults to 50 milliseconds (20 steps/second) if omitted."""
	def step(self, amount=None):
		"""Increments the value option by amount.

        amount defaults to 1.0 if omitted."""
	def stop(self):
		"""Stop autoincrement mode: cancels any recurring timer event
        initiated by start."""

py_simple_ttk.widgets.ProgressbarWidgets.LabeledMultiProgressbar^

Labeled MultiWidget LabeledProgressbar

class LabeledMultiProgressbar(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top', orient='horizontal'):
		...
	def add(self, parent: tkinter.ttk.Frame, key: str, args, kwargs, widget_type=None):
		"""Overrides MultiWidgetMixin to deal with vertical orientation `Returns None`"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def link(self, config: dict):
		"""Link to other widgets with a dict of subwidget keys to link to `Returns None`"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

Radiobutton Widgets^

py_simple_ttk.widgets.RadiobuttonWidgets.LabeledRadiobutton^

Labeled Radiobutton widget

class LabeledRadiobutton(Labeler, Frame):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, options: list = [], default: int = 0, is_child: bool = False, **kw):
		...
	def clear(self):
		"""Sets Radiobutton to its default value. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Enable Radiobutton. `Returns None`"""
	def enable(self):
		"""Disable Radiobutton. `Returns None`"""
	def get(self):
		"""Get Radiobutton value. `Returns a Bool`"""
	def set(self, val: bool):
		"""Set Radiobutton value. `Returns None`"""

py_simple_ttk.widgets.RadiobuttonWidgets.LabeledMultiRadiobutton^

Labeled MultiWidget LabeledRadiobutton

class LabeledMultiRadiobutton(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top'):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Method for adding different widgets to a multiwidget post-instantiation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

Scale Widgets^

py_simple_ttk.widgets.ScaleWidgets.LabeledScale^

Labeled Scale

class LabeledScale(Labeler, Scale):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, command: Callable = None, default: float = 0, orient: bool = 'horizontal', is_child: bool = False, from_=0, to=100, **kwargs):
		...
	def clear(self):
		"""Sets Scale to its default value. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		"""Enable Scale. `Returns None`"""
	def enable(self):
		"""Disable Scale. `Returns None`"""
	def get(self):
		"""Get Scale value. `Returns a Float`"""
	def set(self, val):
		"""Set Scale value. `Returns None`"""

py_simple_ttk.widgets.ScaleWidgets.LabeledMultiScale^

Labeled MultiWidget Labeled Scale

class LabeledMultiScale(Labeler, Frame, MultiWidgetMixin):
	def __init__(self, parent: tkinter.ttk.Frame, labeltext: str, config: dict, is_child: bool = False, labelside='top', orient='horizontal', command=None):
		...
	def add(self, parent, key, args, kwargs, widget_type=None):
		"""Override MultiWidgetMixin for vertical orientation"""
	def clear(self, config: list = None):
		"""Pass a list of subwidgets to clear or all are set to default"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self, config: list = None):
		"""Pass a list of subwidgets to disable or all are disabled"""
	def enable(self, config: list = None):
		"""Pass a list of subwidgets to enable or all are enabled"""
	def get(self, config: list = None):
		"""Pass a list of widget keys to get a dict of outputs"""
	def set(self, config: dict):
		"""Pass a map of widget keys and their values"""

Text Widgets^

py_simple_ttk.widgets.TextWidgets.ScrolledText^

Scrolled Textbox

Scrolled SuperWidget Text. Configure text by passing the textkw argument as a dict formatted like a standard kwarg dict.

class ScrolledText(Scroller, Text, SuperWidgetMixin):
	def __init__(self, parent, **kw):
		...
	def clear(self):
		"""Empties the text box. `Returns None`"""
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		...
	def edit_undo(self):
		"""Undoes the last edit action

        If the undo option is true. An edit action is defined
        as all the insert and delete commands that are recorded
        on the undo stack in between two separators. Generates
        an error when the undo stack is empty. Does nothing
        when the undo option is false
        """
	def enable(self):
		...
	def get(self, start='1.0', end='end'):
		"""Returns the contents of the text box with optional start/end kwargs. `Returns a String`"""
	def get_cursor(self):
		"""Get the current location of the cursor. `Returns None`"""
	def select_all(self, event=None):
		"""Selects all text. `Returns None`"""
	def set(self, val):
		"""Sets the text. `Returns a String`"""
	def window_create(self, index, cnf={}, **kw):
		"""Create a window at INDEX."""

py_simple_ttk.widgets.TextWidgets.CopyBox^

Scrolled Text with "Copy tp Clipboard" Button

A widget with a scrolled textbox and button that copies the textbox contents to the user's clipboard. Useful for form output, etc.

class CopyBox(Frame):
	def __init__(self, parent: tkinter.ttk.Frame, **kw):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def disable(self):
		...
	def enable(self):
		...

Toplevel Widgets^

py_simple_ttk.widgets.ToplevelWidgets.FocusedToplevel^

Base Focused Toplevel Class

Window that takes focus and center's itself on the current window. Used as a base class for other windows.

class FocusedToplevel(Toplevel):
	def __init__(self, *args, title=None, window=None, on_close=None, **kwargs):
		...
	def destroy(self):
		...
	def iconify(self):
		"""Display widget as icon."""
	def iconmask(self, bitmap=None):
		"""Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""

py_simple_ttk.widgets.ToplevelWidgets.NoticeWindow^

Provides the user with a notice.

button_action can call a function to help with determining acceptance vs. the user hitting the exit button.

class NoticeWindow(FocusedToplevel):
	def __init__(self, *args, text=None, button_text='Continue', button_action=None, **kwargs):
		...
	def destroy(self):
		...
	def iconify(self):
		"""Display widget as icon."""
	def iconmask(self, bitmap=None):
		"""Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""

py_simple_ttk.widgets.ToplevelWidgets.YesNoCancelWindow^

Provides the user with a yes/no/cancel option.

no_destroy can be set to True to allow the window to remain open after a selection is made.

class YesNoCancelWindow(FocusedToplevel):
	def __init__(self, *args, text: str = None, yes_enabled: bool = True, on_yes=None, yes_text: str = 'Yes', no_enabled: bool = True, on_no=None, no_text: str = 'No', cancel_enabled: bool = True, on_cancel=None, cancel_text: str = 'Cancel', no_destroy: bool = False, focus='', **kwargs):
		...
	def destroy(self):
		...
	def iconify(self):
		"""Display widget as icon."""
	def iconmask(self, bitmap=None):
		"""Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""

py_simple_ttk.widgets.ToplevelWidgets.PromptWindow^

Prompts the user for a text input

no_destroy can be set to True to allow the window to remain open after a selection is made, useful for informing the user a string input was invalid via setting label_var. If the select_type kwarg is set to true the user will be prompted to select a data type (int / string) to return.

class PromptWindow(FocusedToplevel):
	def __init__(self, *args, text: str = 'Enter Text:', on_yes=None, yes_text: str = 'Continue', on_cancel=None, cancel_text: str = 'Cancel', bind_enter: bool = True, no_destroy: bool = False, select_type: bool = False, focus='', **kwargs):
		...
	def destroy(self):
		...
	def iconify(self):
		"""Display widget as icon."""
	def iconmask(self, bitmap=None):
		"""Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""

py_simple_ttk.widgets.ToplevelWidgets.PasswordWindow^

Password Entry window.

Demo Password Entry Window, you will want to copy the source for this widget and rewrite it.

class PasswordWindow(FocusedToplevel):
	def __init__(self, window=None, **kwargs):
		...
	def destroy(self):
		...
	def iconify(self):
		"""Display widget as icon."""
	def iconmask(self, bitmap=None):
		"""Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""

py_simple_ttk.widgets.ToplevelWidgets.ListWindow^

Window to select an option from a Scrolled Listbox

class ListWindow(FocusedToplevel):
	def __init__(self, *args, options: list, text: str = 'Select Item:', on_yes=None, yes_text: str = 'Continue', on_cancel=None, cancel_text: str = 'Cancel', no_destroy: bool = False, select_mode: str = 'single', **kwargs):
		...
	def destroy(self):
		...
	def iconify(self):
		"""Display widget as icon."""
	def iconmask(self, bitmap=None):
		"""Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""

Misc Widgets^

py_simple_ttk.widgets.ToolTip.ToolTip^

Easy ToolTip

Easily show theme-friendly tooltip. Currently only left and right align are supported.

class ToolTip(ToolTipBase):
	def __init__(self, tipwidget, text: str, align='left'):
		...

py_simple_ttk.widgets.SizegripWidgets.EasySizegrip^

Sizegrip widget with bindings

Automatically packs self and binds mouse presses for systems that don't bind automatically.

class EasySizegrip(Sizegrip):
	def __init__(self, *args, **kwargs):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""

SuperLib.utils^

Utils^

py_simple_ttk.utils.utils.check_if_module_installed^

Indicates if a packages is installed. Returns a Boolean

</code></pre>
</blockquote>
<p>def check_if_module_installed(package):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.check_string_contains^

Returns (True, char_index) if any character from the list exists in the string otherwise returns (False, None)

</code></pre>
</blockquote>
<p>def check_string_contains(string: str, contains_list: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.dummy_function^

Dummy function that nicely prints out any passed args and kwargs. Returns None

</code></pre>
</blockquote>
<p>def dummy_function(*args, **kwargs):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.get_friendly_time^

Gets a time string in one of several modes. Modes: all, time, date, nice_date. Returns a String

</code></pre>
</blockquote>
<p>def get_friendly_time(timestamp, mode='all'):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.get_installed_packages^

Get an alphabetized list of available packages. Returns a List

</code></pre>
</blockquote>
<p>def get_installed_packages():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.get_unix_timestamp^

Get a unix timestamp. Returns a Float

</code></pre>
</blockquote>
<p>def get_unix_timestamp():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.get_unix_timestring^

Get a unix timestring. Returns a String

</code></pre>
</blockquote>
<p>def get_unix_timestring():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.get_user_home_folder^

Cross-platform function to get a user's home folder

</code></pre>
</blockquote>
<p>def get_user_home_folder():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.open_folder_in_explorer^

Cross-platform way to open a folder in the default file manager for a system

</code></pre>
</blockquote>
<p>def open_folder_in_explorer(path):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.sort_dict_by_keys^

Sorts a dictionary by its keys

</code></pre>
</blockquote>
<p>def sort_dict_by_keys(source: dict, reverse: bool = False):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.utils.timer_decorator^

Decorator to add timing to a function

</code></pre>
</blockquote>
<p>def timer_decorator(proc):</p>
<blockquote>
<p>...</p>
<pre><code>

File Generators^

py_simple_ttk.utils.HTML_Generator.HTML_Generator^

class HTML_Generator(object):
	def __init__(self, indent='\t'):
		...
	def add_body_line(self, text=''):
		...
	def add_bold(self, text=''):
		...
	def add_center(self, text=''):
		...
	def add_comment(self, text):
		...
	def add_div(self, text=''):
		...
	def add_divider(self):
		...
	def add_list(self, items=[], ordered=False):
		...
	def add_list_item(self, item: str):
		...
	def add_paragraph(self, text=''):
		...
	def assemble(self):
		...
	def end_bold(self):
		...
	def end_center(self):
		...
	def end_div(self):
		...
	def end_list(self, ordered=False):
		...
	def end_paragraph(self):
		...
	def get_indent(self, offset=0):
		...
	def save(self, path):
		...
	def start_bold(self, text=''):
		...
	def start_center(self, text=''):
		...
	def start_div(self, text=''):
		...
	def start_list(self, items=[], ordered=False):
		...
	def start_paragraph(self, text=''):
		...

py_simple_ttk.utils.TXT_Generator.TXT_Generator^

class TXT_Generator(object):
	def __init__(self, ):
		...
	def add_body_line(self, text=''):
		...
	def add_divider(self):
		...
	def assemble(self):
		...
	def save(self, path):
		...

py_simple_ttk.utils.MD_Generator.MD_Generator^

class MD_Generator(object):
	def __init__(self, title=None, footnote_title='Notes:', footnote_heading_level=2, numbered_toc=False):
		...
	def add_blockquote(self, text, end='\n\n'):
		...
	def add_bold(self, text, end='\n\n'):
		...
	def add_bold_italic(self, text, end='\n'):
		...
	def add_break(self):
		...
	def add_code_block(self, text, lang='', end='\n'):
		...
	def add_heading_1(self, text, **kwargs):
		...
	def add_heading_2(self, text, **kwargs):
		...
	def add_heading_3(self, text, **kwargs):
		...
	def add_heading_4(self, text, **kwargs):
		...
	def add_heading_5(self, text, **kwargs):
		...
	def add_heading_6(self, text, **kwargs):
		...
	def add_horizontal_rule(self):
		...
	def add_italic(self, text, end='\n'):
		...
	def add_link(self, link, text=None, tooltip=None):
		...
	def add_multi_blockquote(self, texts):
		...
	def add_ordered_list(self, texts, indent=0):
		...
	def add_paragraph(self, text, end='\n\n'):
		...
	def add_to_ordered_list(self, index, text, indent=0):
		...
	def add_to_unordered_list(self, text, indent=0):
		...
	def add_toc(self, title, end='\n\n'):
		...
	def add_unordered_list(self, texts, indent=0):
		...
	def assemble(self):
		...
	def decrease_toc_depth(self):
		...
	def get_prefix(self):
		...
	def increase_toc_depth(self):
		...
	def insert_footnote(self, text):
		...
	def save(self, path):
		...
	def set_slogan(self, slogan):
		...

History Mixin^

py_simple_ttk.utils.History.HistoryMixin^

Abstract mixin to add history-tracking to an application

This object is meant to be used as a mixin rather than instantiated directly most of the time.

class HistoryMixin(object):
	def __init__(self, data):
		...
	def add_history(self, data):
		...
	def clear_history(self, data):
		...
	def get_history_uid(self):
		...
	def redo(self):
		...
	def undo(self):
		...

Color Functions^

py_simple_ttk.utils.color.reduce_255^

Limits a val to a range of 0 to 255

</code></pre>
</blockquote>
<p>def reduce_255(in_value: int, maxval: int = 255):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.rgb_to_hex^

Converts an rgb tuple to hex

</code></pre>
</blockquote>
<p>def rgb_to_hex(rgb: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.rgba_to_hex^

Converts an rgba tuple to rgba hex

</code></pre>
</blockquote>
<p>def rgba_to_hex(rgba: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.hex_to_rgb^

Converts hex to rgb tuple

</code></pre>
</blockquote>
<p>def hex_to_rgb(hex: str):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.hex_to_rgba^

Tries to convert rgba hex to rgba, on failure converts rgb hex to rgb and sets a full opacity

</code></pre>
</blockquote>
<p>def hex_to_rgba(hex: str):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.get_gradient^

Generates a gradient with a given number of steps

</code></pre>
</blockquote>
<p>def get_gradient(steps: int):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.rgb_to_scalar^

Converts an rgb itterable to scalar list

</code></pre>
</blockquote>
<p>def rgb_to_scalar(rgb: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.scalar_to_rgb^

Converts rgb scalar to rgb list

</code></pre>
</blockquote>
<p>def scalar_to_rgb(rgb: tuple):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.linear_gradient^

Generates a linear gradient between two colors, accepts html hex or rgb formats

</code></pre>
</blockquote>
<p>def linear_gradient(start_hex: str = '#000000', finish_hex: str = '#FFFFFF', n: int = 10):</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.color.get_rainbow^

Generates a rainbow with a given number of steps. Steps must be divisible by 4)

</code></pre>
</blockquote>
<p>def get_rainbow(steps: int):</p>
<blockquote>
<p>...</p>
<pre><code>

MegaWidgets^

Notes MegaWidget^

py_simple_ttk.mega_widgets.notes.NotesTab^

class NotesTab(Tab):
	def __init__(self, notebook, app):
		...
	def copy_note(self, note):
		...
	def delete_note(self, note):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def export_note_html(self, note):
		...
	def export_note_json(self, note):
		...
	def export_note_markdown(self, note):
		...
	def export_note_text(self, note):
		...
	def load_notes(self):
		...
	def make_new_note(self, title):
		...
	def new_note(self, event=None):
		...
	def on_toplevel_destroy(self, *args):
		"""Function for toplevels to call on no / cancel"""
	def reload_notes(self):
		...
	def rename_note(self, note):
		...
	def start_new_note(self, title=None):
		...

Conversation MegaWidget^

py_simple_ttk.mega_widgets.chat.ConversationsTab^

class ConversationsTab(Tab):
	def __init__(self, notebook, app):
		...
	def copy_conversation(self, conversation):
		...
	def delete_conversation(self, conversation):
		...
	def destroy(self):
		"""Destroy this and all descendants widgets."""
	def export_conversation_html(self, conversation):
		...
	def export_conversation_json(self, conversation):
		...
	def export_conversation_markdown(self, conversation):
		...
	def export_conversation_text(self, conversation):
		...
	def get_cached_icon(self, size, color, char):
		...
	def get_user_icon(self, user):
		...
	def load_conversations(self):
		...
	def make_new_conversation(self, title):
		...
	def new_conversation(self, event=None):
		...
	def on_toplevel_destroy(self, *args):
		"""Function for toplevels to call on no / cancel"""
	def reload_conversations(self):
		...
	def rename_conversation(self, conversation):
		...
	def start_new_conversation(self, title=None):
		...

Profile Management^

py_simple_ttk.utils.ProfilesSystem.ProfilesSystem^

class ProfilesSystem(object):
	def __init__(self, select_profile_actions: list = [], refresh_profiles_actions: list = [], profiles_dir: str = 'C:\\Users\\arcti\\github\\py_simple_ttk\\Profiles', handle_duplicates: bool = True):
		...
	def add_refresh_profiles_action(self, action):
		"""Add an action to the profiles list refresh actions"""
	def add_refresh_profiles_actions(self, actions: list):
		"""Add a list of actions to the profiles list refresh actions"""
	def add_select_profile_action(self, action):
		"""Add an action to the profile switch actions"""
	def add_select_profile_actions(self, actions: list):
		"""Add a list of actions to the profile switch actions"""
	def check_if_name_exists_in_profiles(self, name: str, profiles: list = None):
		"""Check if a name exists in a list of profiles, if no list is provided uses the list of all profiles. `Returns a Bool`"""
	def clear_refresh_profile_actions(self, new: list = []):
		"""Clear out the profiles list refresh actions, optionally replacing them with new ones"""
	def clear_select_profile_actions(self, new: list = []):
		"""Clear out the profile switch actions, optionally replacing them with new ones"""
	def create_profile(self, name: str):
		"""Creates a profile with a given name. `Raises ValueError` if the profile name already exists. `Returns a UserProfile`"""
	def delete_profile(self, profile: py_simple_ttk.utils.ProfilesSystem.UserProfile):
		...
	def get_last_used_profile(self, profiles: list = None):
		"""Returns the most recently accessed profile"""
	def get_profile_by_username(self, name: str):
		...
	def get_profile_names(self):
		"""Returns an alphabetically sorted list of profile names"""
	def handle_duplicate_profile_names(self, name: str):
		"""Makes profile names unique if they have identical names. The most recently accessed profile (according to the file json) keeps its name untouched. `Returns None`"""
	def handle_refresh_profiles_actions(self):
		"""Handle on-refresh-profiles actions"""
	def handle_select_profile_actions(self):
		"""Handle on-profile-selection actions"""
	def select_profile(self, profile: py_simple_ttk.utils.ProfilesSystem.UserProfile):
		"""Change the currently selected profile"""
	def select_profile_by_username(self, name: str):
		...
	def sort_profiles_by_accessed(self, profiles: list = None):
		"""Sort a list of profiles by last accessed, if no list is provided returns a sorted list of all profiles in the system. `Returns a List`"""

py_simple_ttk.utils.ProfilesSystem.UserProfile^

A class to represent a User / User's Preferences

Must pass a unique username and a unique identifier for new profile.

class UserProfile(object):
	def __init__(self, path, username: str = None, atomic: str = None):
		...
	def clear_preferences(self, preferences: list = None):
		...
	def get_preference(self, key: str):
		...
	def load(self, path: str = None, overwrite_path=False):
		...
	def save(self, path: str = None, overwrite_path=False):
		...
	def set_preference(self, key: str, value: str):
		...
	def set_username(self, name: str):
		...

py_simple_ttk.utils.ProfilesSystem.get_profiles_folder^

Gets the absolute path to the included profiles folder. Returns a String

</code></pre>
</blockquote>
<p>def get_profiles_folder():</p>
<blockquote>
<p>...</p>
<pre><code>

py_simple_ttk.utils.ProfilesSystem.get_profiles_list^

Gets a list of profile files at a given path. Returns a List of Path strings

</code></pre>
</blockquote>
<p>def get_profiles_list(path='./Profiles', verbose=False):</p>
<blockquote>
<p>...</p>
<pre><code>

Changelog^

0.1.10^

Add LabeledPathEntry to EntryWidgets.py

0.1.9^

Add pencil icons to assets

0.1.8^

Fix labeled button not running command on press

0.1.7^

add labeled button

0.1.6^

Fix missing Labeler import

0.1.5^

Fix broken package

0.1.4^

Fix broken package

0.1.3^

More cleanup, input fixes.py

0.1.2^

Cleanup, move type lists to generate_readme.py

0.1.1^

Fix missing 'ListWindow' import in app.py

0.1.0^

Modulize

Generated with py_simple_readme

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

py_simple_ttk-0.1.10-py3-none-any.whl (77.3 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page