Tkinter Layout Helpers
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()).set_column_span(4)
row.add(tk.Entry()).set_column_span(1)
with grid.new_row() as row:
row.add(tk.Entry()).set_column_span(3)
row.add(tk.Entry()).set_column_span(2)
with grid.new_row() as row:
row.add(tk.Entry()).set_column_span(2)
row.add(tk.Entry()).set_column_span(3)
with grid.new_row() as row:
row.add(tk.Entry()).set_column_span(1)
row.add(tk.Entry()).set_column_span(4)
for column in grid.columns:
column.configure(weight=1)
root.mainloop()
Gives the following result:
Example for the pack_manager:
import tkinter as tk
from tkinter_layout_helpers import pack_manager
root = tk.Tk()
with pack_manager(root, fill=tk.BOTH) as packer:
packer.pack_left(tk.Label(text="Left bar", relief=tk.RAISED))
packer.pack_top(tk.Label(text="Top bar", relief=tk.RAISED))
packer.pack_bottom(tk.Label(text="Bottom bar", relief=tk.RAISED))
packer.pack_right(tk.Label(text="Right bar", relief=tk.RAISED))
packer.pack_expanded(tk.Text())
root.mainloop()
Result:
More examples see here: examples
Metadata
Release files for tkinter-layout-helpers 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tkinter_layout_helpers-0.6.0.tar.gz | 55.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tkinter_layout_helpers-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.4 kB
Release files / tkinter_layout_helpers-0.6.0.tar.gz
| Download URL | tkinter_layout_helpers-0.6.0.tar.gz |
|---|---|
| Size | 55.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb9d62694bfee0d2ab85e71dd8a6fde93154372c3f0af06b7485fa89f2371854
|
|
BLAKE2b-256 checksum How to use checksums |
cc1fd404c1a73481d5a978ac12dd1830a28c7eb8e2bf9028397a6a37ef4412ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2025.
Transparency logRelease files / tkinter_layout_helpers-0.6.0-py3-none-any.whl
| Download URL | tkinter_layout_helpers-0.6.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ce16756edf4e2dbe5c830de959f9ea9673eee35c9710768f958d6bb32b5f6d2
|
|
BLAKE2b-256 checksum How to use checksums |
abcb71609ae33c4958a6ebe59e20e5a80bdd0320c2f982e84b13fd8db4e726de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2025.
Transparency log