Skip to main content

Custom widgets for tkinter

Project description

STkWidgets

A collection of custom Tkinter widgets that extend the standard toolkit with modern UI features. Useful for building desktop apps with a cleaner and more functional interface.


Installation

pip install .


Example:

import customtkinter as ct from stk_widgets import ToolTip, OptionList, PasswordEntry, Spinner, ArcSpinner, VerticalTab, ClickableLabel,
CircleButton, stkmessagebox, StkFileDialog, layouts,STk, screenshot_frame

from stk_widgets.window.layouts import DraggableWidget

STk is a rudimentary attempt at a custom window, it is very buggy so only use if you can fix or are okay with it

It's preferable to use regular tk, ttk or ctk

root = STk()

root.set_title("Test Application") root.geometry("500x500")

Adds the default buttons for window control

root.add_default_winbtns()

entry = PasswordEntry(root.set_titlebar.right_container)

x =ct.CTkSegmentedButton(root.set_titlebar.right_container, values=["system", "light", "dark"], command=lambda e: ct.set_appearance_mode(e))

#add widgets to title bar root.add_widget_to_titlebar(entry) root.add_widget_to_titlebar(x)

Vertical tabview

tabview = VerticalTab(root, width=600, height=400) tabview.pack(fill="both", expand=True)

button = ct.CTkButton(root, text="take screenshot", command=lambda: screenshot_frame(root, "screenshots")) button.pack() ToolTip(button, "hey, I can take screenshots.")

Add tabs

tab1 = tabview.add_tab("Home", button_style="circular")#button styles [circular, regular] ct.CTkLabel(tab1, text="This is the Home tab").pack(pady=20)

tab2 = tabview.add_tab("Settings") ct.CTkLabel(tab2, text="This is the Settings tab").pack(pady=20)

tab3 = tabview.add_tab("About") ct.CTkLabel(tab3, text="This is the About tab").pack(pady=20)

frame = ct.CTkFrame(tab1) frame.pack(padx=20, pady=20, fill="both", expand=True)

Appears on left click and displays a group of options

options = OptionList(frame)

Adds a label to the widget, also takes in a font argument

options.add_label("File Options")

#add buttons, buttons also take in argument like hover and color options.add_button("Open", command=lambda: print("open clicked")) options.add_button("Delete", color="red", command=lambda: print("delete clicked")) options.add_button("Restore", command=lambda: print("restore clicked")) lab = ct.CTkLabel(tab3) lab.pack()

A password entry with show and hide

p = PasswordEntry(tab3, password_hide_text="hide", password_show_text="show") p.pack()

A circular button

CircleButton(tab2, text="Click me", command=lambda: StkFileDialog(root, "just testing")).pack(pady=20)

#a clickable label, can be used for links or anything of the sort ClickableLabel(tab3, text="This is the About tab", command=lambda :stkmessagebox.showinfo("Info", "This is a messagebox")).pack(pady=20)

Loading animations

Spinner(root).pack(pady=20, expand=True, fill="both") ArcSpinner(root).pack(pady=20, expand=True, fill="both")

btn = ct.CTkButton(tab3, text="testing layout and drag") btn2 = ct.CTkButton(tab3,text="testing layout") btn3 = ct.CTkButton(tab3, text="testing layout")

Arranges widgets in a list, other layouts include:

#layouts.WeightedGridLayout #layouts.VerticalListLayout #layouts.GridLayout layouts.ListLayout([btn, btn2, btn3])

Makes widgets draggable

DraggableWidget( btn, constrain_to_parent=False #detemines if the widget should be constrained to its parent/master )

root.mainloop()


Available Widgets

CirularButton → a completely circular button

PasswordEntry → Entry widget with show and hide functionality

ClickableLabel → A label that can be clicked, useful for links

Spinner & ArcSpinner → loading animations

Tooltip → a tooltip that appears on hover

OptionList → appears on left-click and displays options

TyperWriterEffect → not a widget but simulates typewiter effect on given widget

VerticalTab → like ctktabview but vertical

stkmessagebox → a themed messagebox

STkMenuBar → a custom themed implementation of the menubar

STkFileDialog → a custom filedialog implementation


Requirements

Python 3.8+

Tkinter

CustomTkinter

Pillow


License

This project is licensed under the Apache License 2.0 - see the [LICENSE] file for details


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

stk_widgets-0.1.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stk_widgets-0.1.0-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file stk_widgets-0.1.0.tar.gz.

File metadata

  • Download URL: stk_widgets-0.1.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for stk_widgets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 206f6f84f626f0f2338d35fb3bf62bd0c608f4452015b148bc997fcd2de62e08
MD5 399c8dd242c0c7f4d19ec56279db8be3
BLAKE2b-256 dff30d6c03c72d5f42d92a2ca95cad8487a60dba96b9578147d8ab6eae367062

See more details on using hashes here.

File details

Details for the file stk_widgets-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stk_widgets-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for stk_widgets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4e9f0332f7724877c33a0bafb2f6fb43152758c1909639b6741e0d4e33836b0
MD5 45939cf276561b46d3dea842e0c78a9a
BLAKE2b-256 acec1d8ca276c8a3fba90e22e2cb4264deda196ff85b0594c10c4e965bf0c713

See more details on using hashes here.

Supported by

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