Skip to main content

A collection of custom tkinter bits

Project description

Tk-steroids

Tk-steroids contains some useful GUI elements (tkinter/tk widgets) such as a selection boxes or matplotlib integration that keep reoccuring in my code elsewhere.

Installing

pip install tk-steroids

Usage

from tk_steroids.MODULE import WIDGET
  • elements
    • Listbox
    • TickboxFrame
    • DropdownList
    • Tabs
    • ButtonsFrame
  • matplotlib
    • CanvasPlotter
    • SequenceImshow
  • dialogs
    • TickSelect
  • menumaker
    • MenuMaker

Most of the widgets inherit from tk.Frame and use grid positioning system internally. There are exceptions to this logic such as MenuMaker that creates a menu from a class that is inheriting it (when calling _connect).

Example 1

The following example adds TickboxFrame on the second Tab page

import tkinter as tk
from tk_steroids.elements import Tabs, TickboxFrame

root = tk.Tk()

my_tabs = Tabs(root, ['Page 1', 'Page 2', 'Page 3'])
my_tabs.grid()

boxes = TickboxFrame(my_tabs.tabs[1], ['a', 'b', "c"], ['Fancyname A', 'Fabolous B', 'Handsome C'])
boxes.grid()

root.mainloop()

Example 2

This example shows how CanvasPlotter simplifies the matplotlib in Tk routine

import tkinter as tk
from tk_steroids.matplotlib import CanvasPlotter

root = tk.Tk()

plotter = CanvasPlotter(root)
plotter.grid()

# These are normal matplotlib figure and ax, also available
# - plotter.figure
# - plotter.ax
fig, ax = plotter.get_figax()

ax.plot([0,4,2])

# Calls FigureCanvasTkAgg draw-method
plotter.update()

root.mainloop()

For convinience, CanvasPlotter has also its own plot and imshow methods.

Other

In these 0.x.y versions, things can change quite a lot (no guaranteed API stability).

Project details


Download files

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

Source Distribution

tk-steroids-0.7.0.tar.gz (33.0 kB view details)

Uploaded Source

Built Distribution

tk_steroids-0.7.0-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file tk-steroids-0.7.0.tar.gz.

File metadata

  • Download URL: tk-steroids-0.7.0.tar.gz
  • Upload date:
  • Size: 33.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for tk-steroids-0.7.0.tar.gz
Algorithm Hash digest
SHA256 306928be8734549caa8b99089ab66b24d2d2fb2fcd93187cd2098bfacd30948b
MD5 e827733486b1344040a7cfcb18f463f5
BLAKE2b-256 30cfc8482419ecae795c925c86ed6530fbd96f6889f0155eef695ae51b2fd8bb

See more details on using hashes here.

File details

Details for the file tk_steroids-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: tk_steroids-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for tk_steroids-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca28a9f721d4b6d1148faa444b0ef286553c89f0f795bb44a15977055df5fb41
MD5 7332f4eb8d3ffd3d043a04096750291a
BLAKE2b-256 e37475d2dfdc096593ecd8dd4f141d53c58a2d104f29c9433ba525721f3a5717

See more details on using hashes here.

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