A library which is intended to simplify a placement of widgets with .grid() and .pack() methods
Project description
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tkinter_layout_helpers-0.6.0.tar.gz.
File metadata
- Download URL: tkinter_layout_helpers-0.6.0.tar.gz
- Upload date:
- Size: 55.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9d62694bfee0d2ab85e71dd8a6fde93154372c3f0af06b7485fa89f2371854
|
|
| MD5 |
aacad38be507548cc095f92933f44b86
|
|
| BLAKE2b-256 |
cc1fd404c1a73481d5a978ac12dd1830a28c7eb8e2bf9028397a6a37ef4412ed
|
Provenance
The following attestation bundles were made for tkinter_layout_helpers-0.6.0.tar.gz:
Publisher:
pypi-deploy.yml on insolor/tkinter-layout-helpers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tkinter_layout_helpers-0.6.0.tar.gz -
Subject digest:
bb9d62694bfee0d2ab85e71dd8a6fde93154372c3f0af06b7485fa89f2371854 - Sigstore transparency entry: 345954833
- Sigstore integration time:
-
Permalink:
insolor/tkinter-layout-helpers@b4fa5d4a4282b9330b2188aa536ab9dbeed07c60 -
Branch / Tag:
refs/tags/0.6.0 - Owner: https://github.com/insolor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@b4fa5d4a4282b9330b2188aa536ab9dbeed07c60 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tkinter_layout_helpers-0.6.0-py3-none-any.whl.
File metadata
- Download URL: tkinter_layout_helpers-0.6.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ce16756edf4e2dbe5c830de959f9ea9673eee35c9710768f958d6bb32b5f6d2
|
|
| MD5 |
aab6810fe4070c2b6a60d66424ecbd09
|
|
| BLAKE2b-256 |
abcb71609ae33c4958a6ebe59e20e5a80bdd0320c2f982e84b13fd8db4e726de
|
Provenance
The following attestation bundles were made for tkinter_layout_helpers-0.6.0-py3-none-any.whl:
Publisher:
pypi-deploy.yml on insolor/tkinter-layout-helpers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tkinter_layout_helpers-0.6.0-py3-none-any.whl -
Subject digest:
8ce16756edf4e2dbe5c830de959f9ea9673eee35c9710768f958d6bb32b5f6d2 - Sigstore transparency entry: 345954836
- Sigstore integration time:
-
Permalink:
insolor/tkinter-layout-helpers@b4fa5d4a4282b9330b2188aa536ab9dbeed07c60 -
Branch / Tag:
refs/tags/0.6.0 - Owner: https://github.com/insolor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@b4fa5d4a4282b9330b2188aa536ab9dbeed07c60 -
Trigger Event:
release
-
Statement type: