Skip to main content

A simple Tkinter-based grid of resizable buttons with configurable spans and callbacks.

Project description

ButtonPad

ButtonPad is a tiny, pure-standard-library (Tkinter) package that creates a resizable grid of buttons. Buttons can span rectangular regions (like HTML rowspan/colspan), and each button supports on_click, on_enter, and on_exit callbacks as well as runtime changes to caption and colors.

Quick start

python -m buttonpad

This runs the phone-keypad demo.

Usage

from buttonpad import ButtonPad

labels = """1,2,3
4,5,6
7,8,9
*,0,#"""

pad = ButtonPad(
    labels,
    button_width_px=100,
    button_height_px=60,
    hgap_px=8,
    vgap_px=8,
    button_bg="#eeeeee",
    button_fg="#000000",
    window_bg="#f0f0f0",
    title="ButtonPad Demo",
    resizable=True,
)

# Access buttons (top-left owners in row-major order)
for b in pad.buttons:
    b.on_click = lambda btn=b: print("Clicked:", btn.caption)

pad.run()

Spanning example

Hello, Hello, 3
Hello, Hello, 6
7, 8, 9
*, 0, #

The four Hello cells form one 2x2 button.

License

MIT

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

buttonpad-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

buttonpad-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: buttonpad-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for buttonpad-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0506e87123f97026ff810418cf7532721aab0af1ae47224e2e654541bc66469d
MD5 2d2d5c1b53e8ef205bf3907797ceccac
BLAKE2b-256 08aed46c64630118e8ae50eb08dcc080d359cfe1ad82de5553e3d301b626667b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: buttonpad-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for buttonpad-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff3e086ec0a59dd144865bd95f8020407bc723eebd792cac33e38a10240aa7b5
MD5 de03e4322ff4ea06c1757bf5c4472204
BLAKE2b-256 76c040c3d521c184e194d2dba020b5485178f876b9b931ed5f3e2eef129658dd

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