Skip to main content

Simplifies the implementation of Tkinter UI layouts by allowing the developer to describe the hierarchy of UI elements from the inside out.

Project description

This library simplifies the layout of Tkinter user interfaces by allowing the developer to specify the structure of the interface elements from the inside out.

Whereas Tkinter requires that nested frames and other widgets be created from the outside in (i.e., the outermost frame created first), the layout of an interface is often easier to conceptualize and describe from the inside out. For example, a layout composed of the following elements:

+------------------------------------+
|              Element D             |
+-------------------+----------------+
|    Element A      |                |
+-------------------+    Element C   |
|    Element B      |                |
+-------------------+----------------+
|              Element E             |
+------------------------------------+

could be described as

  • Elements A and B vertically arranged in a column,

  • Joined left to right with Element C in a row,

  • Joined in a single column with Element D above and Element E below.

This sort of narrative description can be easily represented in code by assigning names to each of the layout elements (e.g., “A”, “B”, “C”, “D”, and “E”), instantiating an object of the AppLayout class from the tklayout module (e.g., “lo”), and then calling the following methods:

ab = lo.column_elements(["A", "B"])
abc = lo.row_elements([ab, "C"])
app = lo.column_elements(["D", abc, "E"])

and then creating the frames to represent this layout with:

lo.create_layout(root, app)

Restructuring the application’s layout is easily done simply by changing the calls to the row_elements() and column_elements() methods.

Full documentation is at ReadTheDocs: http://tklayout.readthedocs.io/

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

tklayout-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file tklayout-1.0.0.tar.gz.

File metadata

  • Download URL: tklayout-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tklayout-1.0.0.tar.gz
Algorithm Hash digest
SHA256 217a060f8165bc96c42c32b23128114cdf6a2658943b8dc9517aa97856155f18
MD5 75b03d893670634fad6885cf3e5f050d
BLAKE2b-256 fe12d6861d54e00d9aa95b858f22e0259e39c17247202c4a509101ca57ea0838

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