tkinter-layout-helpers


Nametkinter-layout-helpers JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/insolor/tkinter_layout_helpers
SummaryA library which is intended to simplify a placement of widgets with .grid() and .pack() methods
upload_time2023-06-03 11:02:43
maintainer
docs_urlNone
authorinsolor
requires_python>=3.7,<4.0
licenseMIT
keywords tkinter grid pack
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/insolor/tkinter_layout_helpers",
    "name": "tkinter-layout-helpers",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "tkinter,grid,pack",
    "author": "insolor",
    "author_email": "insolor@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/63/78/ce833a422be823f833091a8b8f32fb0251d228c428314ea28cb6dfb60a2a/tkinter_layout_helpers-0.3.0.tar.gz",
    "platform": null,
    "description": "# Tkinter Layout Helpers\n\n[![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)\n[![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)\n[![PyPI](https://img.shields.io/pypi/v/tkinter_layout_helpers)](https://pypi.org/project/tkinter_layout_helpers/)\n![Supported Python versions](https://img.shields.io/pypi/pyversions/tkinter_layout_helpers)\n\n\nA library which is intended to simplify a placement of widgets with `.grid()` and `.pack()` methods:\n\n- avoid manual calculation of indices of columns and rows when you add a widget;\n- avoid typing-in some common parameters (like `sticky=tk.EW`) each time you add a widget;\n- and more...\n\nWork in progress.\n\nAs an example, this code:\n\n```python\nimport tkinter as tk\nfrom tkinter_layout_helpers.grid_helper import grid_manager\n\nroot = tk.Tk()\n\nwith grid_manager(root, sticky=tk.EW) as grid:\n    grid.new_row() \\\n        .add(tk.Label(text=\"0\", width=20)) \\\n        .add(tk.Label(text=\"1\", width=20)) \\\n        .add(tk.Label(text=\"2\", width=20)) \\\n        .add(tk.Label(text=\"3\", width=20)) \\\n        .add(tk.Label(text=\"4\", width=20))\n\n    grid.new_row().add(tk.Entry()).column_span(4).add(tk.Entry()).column_span(1)\n    grid.new_row().add(tk.Entry()).column_span(3).add(tk.Entry()).column_span(2)\n    grid.new_row().add(tk.Entry()).column_span(2).add(tk.Entry()).column_span(3)\n    grid.new_row().add(tk.Entry()).column_span(1).add(tk.Entry()).column_span(4)\n\n    grid.columnconfigure(0, weight=1)\n    grid.columnconfigure(1, weight=1)\n    grid.columnconfigure(2, weight=1)\n    grid.columnconfigure(3, weight=1)\n    grid.columnconfigure(4, weight=1)\n\nroot.mainloop()\n```\n\nGives the following result:\n\n![image](https://user-images.githubusercontent.com/2442833/153576406-f6a190eb-7f2a-4723-a32e-02af01d93f60.png)\n\nMore examples see here: [examples](https://github.com/insolor/tkinter_layout_helpers/tree/master/examples)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library which is intended to simplify a placement of widgets with .grid() and .pack() methods",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/insolor/tkinter_layout_helpers",
        "Repository": "https://github.com/insolor/tkinter_layout_helpers"
    },
    "split_keywords": [
        "tkinter",
        "grid",
        "pack"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc9141fb9f49d1b9e5bf3ffdfe5c50652d3080d2851c6989ddb06289b21954dc",
                "md5": "d1bf362f056b69bb248285a6c0601c3c",
                "sha256": "1b38f6b7ee6cf2953f87f1963536b8bc20dbcff237c3020d5325f1811af4cec9"
            },
            "downloads": -1,
            "filename": "tkinter_layout_helpers-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1bf362f056b69bb248285a6c0601c3c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 5315,
            "upload_time": "2023-06-03T11:02:42",
            "upload_time_iso_8601": "2023-06-03T11:02:42.104586Z",
            "url": "https://files.pythonhosted.org/packages/fc/91/41fb9f49d1b9e5bf3ffdfe5c50652d3080d2851c6989ddb06289b21954dc/tkinter_layout_helpers-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6378ce833a422be823f833091a8b8f32fb0251d228c428314ea28cb6dfb60a2a",
                "md5": "22e3409ecfc430553d469f060556b78a",
                "sha256": "d7ddb6642c56e15f4b443688db15efd82069856fc76af2df468c45bd27f12910"
            },
            "downloads": -1,
            "filename": "tkinter_layout_helpers-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "22e3409ecfc430553d469f060556b78a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 3875,
            "upload_time": "2023-06-03T11:02:43",
            "upload_time_iso_8601": "2023-06-03T11:02:43.828138Z",
            "url": "https://files.pythonhosted.org/packages/63/78/ce833a422be823f833091a8b8f32fb0251d228c428314ea28cb6dfb60a2a/tkinter_layout_helpers-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-03 11:02:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "insolor",
    "github_project": "tkinter_layout_helpers",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tkinter-layout-helpers"
}
        
Elapsed time: 0.07718s