{ "info": { "author": "Matthew T. Kennerly (mtkennerly)", "author_email": "mtkennerly@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development :: User Interfaces" ], "description": "\n# tkup\n\ntkup is a thin wrapper around standard Tkinter widgets, allowing you to write\ncode that visually reflects the widget hierarchy. It doesn't try to reinvent\nthe wheel and just helps you use normal Tkinter in a streamlined way.\n\nTypical Tkinter code is flat, even though it represents a heavily nested\nstructure, which makes it difficult to quickly read and understand the true\norganization of the GUI. You must also explicitly assign each widget's master,\nwhich is error-prone and verbose:\n\n```python\nimport tkinter as tk\nfrom tkinter import ttk\n\napp = tk.Tk()\napp.title = \"Demo\"\n\nouter_frame = ttk.Frame(app)\nouter_frame.grid()\nhi_button = ttk.Button(outer_frame, text=\"hi\")\nhi_button.grid()\n\napp.mainloop()\n```\n\ntkup solves this by using nested with-statements. There are factory functions\nfor each kind of widget, and you can use them as context managers so that\nnested master widgets are automatically assigned. Post-instantiation calls,\nlike gridding, can be accomplished two ways, most traditionally by naming the\nyielded value:\n\n```python\nfrom tkup import GUI\n\napp = GUI()\n\nwith app.root() as root:\n root.title = \"Demo\"\n with app.frame() as outer_frame:\n outer_frame.grid()\n with app.button(text=\"hi\") as hi_button:\n hi_button.grid()\n\napp.run()\n```\n\nHowever, naming every single widget just to grid it can be tiresome.\nInspired by Kotlin's implicit creation of the `it` variable in lambdas,\nthe GUI class provides an `it` method which returns the current master widget,\nand there is an additional convenience method called `with_it` which returns\nthe GUI instance and its `it` method for quick assignment to variables:\n\n```python\nfrom tkup import GUI\n\napp, it = GUI().with_it()\n\nwith app.root():\n it().title = \"Demo\"\n with app.frame():\n it().grid()\n with app.button(text=\"hi\"):\n it().grid()\n\napp.run()\n```\n\ntkup prefers themed (ttk) widgets wherever available. If you want to use\nclassic widgets, or if you want to use a custom subclass of `tkinter.Widget`,\nthen you can use the GUI `widget` method and pass in the type to instantiate:\n\n```python\nimport tkinter as tk\nfrom tkup import GUI\n\napp = GUI()\n\nwith app.root():\n with app.widget(tk.Button, text=\"foo\"):\n ...\n```\n\n## Installation\n\n```\npip install tkup\n```\n\ntkup supports Python 3.5 and higher.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mtkennerly/tkup", "keywords": "gui tkinter wrapper", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tkup", "package_url": "https://pypi.org/project/tkup/", "platform": "", "project_url": "https://pypi.org/project/tkup/", "project_urls": { "Homepage": "https://github.com/mtkennerly/tkup" }, "release_url": "https://pypi.org/project/tkup/1.2.0/", "requires_dist": null, "requires_python": "", "summary": "Hierarchical Tkinter wrapper", "version": "1.2.0" }, "last_serial": 3716332, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "04c9248879b020cae379583d35764ff8", "sha256": "8faa11a3c1180be9c8ba43b12d49e32a2bce5e495db550eb96f4ab67b11a45a6" }, "downloads": -1, "filename": "tkup-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "04c9248879b020cae379583d35764ff8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5707, "upload_time": "2018-03-04T04:17:09", "url": "https://files.pythonhosted.org/packages/5f/2b/3d33a674e8c72d54d96c1f4011731f3f4837ed6be46863e5932ba03a6fdc/tkup-1.0.0-py3-none-any.whl" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "2b715457bcd25a28734d818f70524169", "sha256": "261cb4b60c07f484573e99205c07e143b8d1f798fe041f2fb46796fa0182daab" }, "downloads": -1, "filename": "tkup-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2b715457bcd25a28734d818f70524169", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6196, "upload_time": "2018-03-04T12:45:18", "url": "https://files.pythonhosted.org/packages/be/ea/7b6f4a35a6e108fb4d73f3d917875f683ccd1fa4939404d8b48b3ea47576/tkup-1.1.0-py3-none-any.whl" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "ff7b48059b2bdd27b25301d13d7133e1", "sha256": "ecf7ba600980a98c1a7bab2e97ce83e22d8112b0ea1172d1fe7404bd0e93e3cc" }, "downloads": -1, "filename": "tkup-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ff7b48059b2bdd27b25301d13d7133e1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6369, "upload_time": "2018-03-29T08:17:59", "url": "https://files.pythonhosted.org/packages/18/4f/eb6461d8de8704771c4284663799b631971efa797495efdf464c091c8ce6/tkup-1.2.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff7b48059b2bdd27b25301d13d7133e1", "sha256": "ecf7ba600980a98c1a7bab2e97ce83e22d8112b0ea1172d1fe7404bd0e93e3cc" }, "downloads": -1, "filename": "tkup-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ff7b48059b2bdd27b25301d13d7133e1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6369, "upload_time": "2018-03-29T08:17:59", "url": "https://files.pythonhosted.org/packages/18/4f/eb6461d8de8704771c4284663799b631971efa797495efdf464c091c8ce6/tkup-1.2.0-py3-none-any.whl" } ] }