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

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.1.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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tkinter_layout_helpers-0.4.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1d3e91296229d2af9269a8e203479a97efc5d2afcb0cbf81adef97cd2928516a
MD5 53d330140f0dcf0c4f503eabff778217
BLAKE2b-256 97044f73808bf082d77a6271ca32e44e868085fa09ba6a1d887e658e0d4a3ef3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tkinter_layout_helpers-0.4.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tkinter_layout_helpers-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48756dad41035102914a38f3e484698cefbb4a0330a059c0177f0e04a128fc0a
MD5 599789dd0d55497934eb8d2cf8845802
BLAKE2b-256 36e0058c5fe184ceee6a236bda69a2f64e31d81d501e864971082cb22c1d2191

See more details on using hashes here.

Provenance

The following attestation bundles were made for tkinter_layout_helpers-0.4.1-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