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 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:
    grid.new_row() \
        .add(tk.Label(text="0", width=20)) \
        .add(tk.Label(text="1", width=20)) \
        .add(tk.Label(text="2", width=20)) \
        .add(tk.Label(text="3", width=20)) \
        .add(tk.Label(text="4", width=20))

    grid.new_row().add(tk.Entry()).column_span(4).add(tk.Entry()).column_span(1)
    grid.new_row().add(tk.Entry()).column_span(3).add(tk.Entry()).column_span(2)
    grid.new_row().add(tk.Entry()).column_span(2).add(tk.Entry()).column_span(3)
    grid.new_row().add(tk.Entry()).column_span(1).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.3.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

tkinter_layout_helpers-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tkinter_layout_helpers-0.3.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1038-azure

File hashes

Hashes for tkinter_layout_helpers-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d7ddb6642c56e15f4b443688db15efd82069856fc76af2df468c45bd27f12910
MD5 22e3409ecfc430553d469f060556b78a
BLAKE2b-256 6378ce833a422be823f833091a8b8f32fb0251d228c428314ea28cb6dfb60a2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tkinter_layout_helpers-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b38f6b7ee6cf2953f87f1963536b8bc20dbcff237c3020d5325f1811af4cec9
MD5 d1bf362f056b69bb248285a6c0601c3c
BLAKE2b-256 fc9141fb9f49d1b9e5bf3ffdfe5c50652d3080d2851c6989ddb06289b21954dc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page