Metadata-Version: 2.1
Name: tkinter-layout-helpers
Version: 0.3.0
Summary: A library which is intended to simplify a placement of widgets with .grid() and .pack() methods
Home-page: https://github.com/insolor/tkinter_layout_helpers
License: MIT
Keywords: tkinter,grid,pack
Author: insolor
Author-email: insolor@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Project-URL: Repository, https://github.com/insolor/tkinter_layout_helpers
Description-Content-Type: text/markdown

# Tkinter Layout Helpers

[![Python package](https://github.com/insolor/tkinter_layout_helpers/actions/workflows/python-tests.yml/badge.svg)](https://github.com/insolor/tkinter_layout_helpers/actions/workflows/python-tests.yml)
[![Coverage Status](https://coveralls.io/repos/github/insolor/tkinter_layout_helpers/badge.svg?branch=master)](https://coveralls.io/github/insolor/tkinter_layout_helpers?branch=master)
[![PyPI](https://img.shields.io/pypi/v/tkinter_layout_helpers)](https://pypi.org/project/tkinter_layout_helpers/)
![Supported Python versions](https://img.shields.io/pypi/pyversions/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:

```python
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](https://user-images.githubusercontent.com/2442833/153576406-f6a190eb-7f2a-4723-a32e-02af01d93f60.png)

More examples see here: [examples](https://github.com/insolor/tkinter_layout_helpers/tree/master/examples)

