Skip to main content

A library which is intended to simplify a placement of widgets with .grid() and .pack() methods

Project description

Tkinter Layout Helpers

Python package documentation Coverage Status PyPI Supported Python versions

A library which is intended to simplify a placement of widgets with .grid() and .pack() methods:

  • avoid manual calculation of indices of columns and rows when you add a widget;
  • avoid typing-in some common parameters (like sticky=tk.EW) each time you add a widget;
  • and more...

Work in progress.

As an example, this code:

import tkinter as tk
from tkinter_layout_helpers.grid_helper import grid_manager

root = tk.Tk()

with grid_manager(root, sticky=tk.EW) as grid:
    with grid.new_row() as row:
        row.add(tk.Label(text="0", width=20))
        row.add(tk.Label(text="1", width=20))
        row.add(tk.Label(text="2", width=20))
        row.add(tk.Label(text="3", width=20))
        row.add(tk.Label(text="4", width=20))

    with grid.new_row() as row:
        row.add(tk.Entry()).column_span(4)
        row.add(tk.Entry()).column_span(1)
    
    with grid.new_row() as row:
        row.add(tk.Entry()).column_span(3)
        row.add(tk.Entry()).column_span(2)
    
    with grid.new_row() as row:
        row.add(tk.Entry()).column_span(2)
        row.add(tk.Entry()).column_span(3)

    with grid.new_row() as row:
        row.add(tk.Entry()).column_span(1)
        row.add(tk.Entry()).column_span(4)

    grid.columnconfigure(0, weight=1)
    grid.columnconfigure(1, weight=1)
    grid.columnconfigure(2, weight=1)
    grid.columnconfigure(3, weight=1)
    grid.columnconfigure(4, weight=1)

root.mainloop()

Gives the following result:

image

More examples see here: examples

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

tkinter_layout_helpers-0.4.0.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

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

tkinter_layout_helpers-0.4.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file tkinter_layout_helpers-0.4.0.tar.gz.

File metadata

  • Download URL: tkinter_layout_helpers-0.4.0.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tkinter_layout_helpers-0.4.0.tar.gz
Algorithm Hash digest
SHA256 45d2ca1eb4b0bdd938aa7ebae39d504bfae1e25155f42d3616f4c0bee4a02043
MD5 671063cac874681dfb48f7b25b895076
BLAKE2b-256 b7edae46900ed5d838c9a462fdf0b9c0e994acd133588d11f2f9cc9f7ce0c1f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for tkinter_layout_helpers-0.4.0.tar.gz:

Publisher: pypi-deploy.yml on insolor/tkinter-layout-helpers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tkinter_layout_helpers-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tkinter_layout_helpers-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9568ae138475dcb6d644bfb1a662d87e021888f41cebd934fffa9e9e61e12d1b
MD5 d860c1b7921698697aa60a9d12be6491
BLAKE2b-256 3160341937466e81772ae1fcbf52093691fc1595d62c1b1152deaf882739c41f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tkinter_layout_helpers-0.4.0-py3-none-any.whl:

Publisher: pypi-deploy.yml on insolor/tkinter-layout-helpers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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