# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['guitk']

package_data = \
{'': ['*']}

setup_kwargs = {
    'name': 'guitk',
    'version': '0.4.1',
    'description': 'Python GUI Toolkit for Tk (guitk): simplify the layout and construction of tkinter graphical user interfaces in python.',
    'long_description': '<!--* DO NOT EDIT README.md, instead edit README.mdpp and process with MarkdownPP using build_readme.sh -->\n\n# Python GUI Toolkit for TK (GUITk)\n\n## Synopsis\n\nGUITk is a declarative framework for building nice-looking, cross-platform GUIs with [tkinter](https://docs.python.org/3/library/tkinter.html) inspired by [SwiftUI](https://developer.apple.com/documentation/swiftui).\n\nGUITk allows you to build complete GUI applications with a few lines of code. GUITk makes it easy to layout your GUI elements and respond to events using a declarative syntax. Because GUITk is built on top of tkinter, you can access the underlying tkinter API if you need to but for many use cases, you can build your GUI without needing to know much about tkinter.\n\nGUITk apps are built by subclasses the `guitk.Window` class. Your GUI elements are layed out using a `guitk.HLayout` (horizontal layout) or `guitk.VLayout` (vertical layout) object which takes care of placing all widgets in the window using a declarative syntax. This is much simpler than using the underlying tkinter [grid manager](https://tkdocs.com/shipman/grid.html) or [pack](https://dafarry.github.io/tkinterbook/pack.htm) geometry managers.\n\nGUITk is in alpha stage but is in constant development so check back frequently if this interests you or open an issue to start a conversation about what pain points this project could help you solve!\n\n## Code Example\n\n### Simple VLayout\n\n![hello.py example](https://raw.githubusercontent.com/RhetTbull/guitk/main/examples/hello.py.png "Hello World example")\n\n```python\n"""Simple Hello World example using guitk """\n\nimport guitk as ui\n\n\n# subclass guitk.Window as the starting point for your app\'s main window\nclass HelloWindow(ui.Window):\n    def config(self):\n        """Configure the window"""\n\n        # set the window title\n        self.title = "Hello, World"\n\n        # define a layout for the window\n        # the layout manager will automatically add widgets to the window\n        with ui.HLayout():\n            ui.Label("What\'s your name?")\n            ui.Entry(key="name", focus=True)\n            ui.Button("Ok")\n\n    @ui.on(key="Ok")\n    def on_ok(self, event: ui.Event):\n        """Handle the Ok button click"""\n        print("Hello, ", self.get("name").value)\n\n\n# run your event loop\nif __name__ == "__main__":\n    HelloWindow().run()\n```\n\n## Motivation\n\nThe goal of GUITk is to make it very easy to create simple and attractive GUI apps with python. It borrows ideas from several other libraries include [PySimpleGUI](https://www.pysimplegui.org/en/latest/), [SwiftUI](https://developer.apple.com/documentation/swiftui), [textual](https://github.com/Textualize/textual), and [applepy](https://github.com/eduardohleite/applepy). GUITk builds on [tkinter](https://docs.python.org/3/library/tkinter.html) which ships with the Python standard library and works across many platforms. tkinter is a mature and powerful GUI framework but requires a fair bit of boiler plate and understanding of the underlying framework to use effectively. GUITk attempts to simplify this by providing a higher level interface to tkinter while still allowing you to access the underlying tkinter API if you need to.\n\nThough you can build simple apps without knowing much about tkinter, GUITk is not intended to fully abstract away the tkinter interface. A basic understanding of tkinter will be helpful when building with GUITk. I highly recommend Mark Roseman\'s excellent [Modern Tkinter for Busy Python Developers](https://tkdocs.com/book.html) book as a starting point.\n\n\n## Installation\n\n* `python3 -m pip install guitk`\n\n## Anatomy of a guitk program\n\n![hello2.py example](https://raw.githubusercontent.com/RhetTbull/guitk/main/examples/hello2.py.png "Hello World example")\n\n```python\n"""Hello World example using guitk """\n\nimport guitk as ui\n\n\nclass HelloWorld(ui.Window):\n    # subclass guitk.Window as the starting point for your app\'s main window\n    def config(self):\n        # Your Window class needs to define a config() method that describes the layout, title, etc for your app\n        # config() is called by the Window class when the Window is being created\n\n        # Title for the window\n        self.title = "Hello, World"\n\n        # optionally set size as a tuple of (width, height)\n        self.size = (320, 240)\n\n        # you can also use self.geometry for consistency with tkinter\n        # self.geometry = "320x240"\n\n        # Define the window\'s contents\n        # guitk.Label corresponds to a tkinter.ttk.Label, etc.\n        # optionally provide a unique key to each element to easily reference the element later\n        # use a HLayout or VLayout class to define the layout of the window\n        # HLayout arranges widgets horizontally, VLayout arranges widgets vertically\n        with ui.VLayout():\n            # use a VLayout to stack the widgets vertically\n            # standard tkinter layout options such as sticky and weight are supported\n            ui.Label("What\'s your name?", sticky="ew", anchor="center", weightx=1)\n            # most widgets emit events; Entry has events turned off by default so enable with events=True\n            # each widget can be assigned a key, which should be unique, to easily reference the widget later\n            # set focus=True so the Entry box has focus when the window is displayed\n            ui.Entry(key="entry_name", events=True, focus=True, weightx=1, sticky="ew")\n            ui.Label("", width=40, key="output")\n            with ui.HStack():\n                # align these two buttons in a horizontal row using HStack\n                ui.Button("Ok")\n                ui.Button("Quit")\n\n    # Every Window class has 3 special methods that can be overridden to provide custom behavior\n    # you do not need to provide any of these methods if you do not need to customize the default behavior\n    # (the default behavior is to do nothing)\n    # These special methods are: setup(), teardown(), and handle_event()\n\n    def setup(self):\n        """Perform any initialization needed before the Window is displayed"""\n        # your setup() method is called by the Window class after config() just before the Window is displayed\n        # use this to initialize any internal state you need\n        # you do not need to provide a setup() method if no initialization is needed\n        print("setup")\n\n    def teardown(self):\n        """Perform any cleanup needed before destroying the window"""\n        # your teardown() method is called by the Window class after the Window is closed\n        # use this to clean up before the Window is destroyed\n        # you do not need to provide a teardown() method if no cleanup is needed\n        print("teardown")\n\n    def handle_event(self, event: ui.Event):\n        """handle_event() is called by the Window class when an event occurs"""\n        # you do not need to provide a handle_event() method if you prefer to use\n        # the @on decorator to bind functions to events (see below)\n        # handle_event() is a useful place to put code that needs to run for every event\n        # or for use during debugging\n        print(f"handle_event: {event}")\n\n    @ui.on(key="Quit")\n    def on_quit(self):\n        # return the value of the Entry box\n        self.quit(self["entry_name"].value)\n\n    @ui.on(key="Ok")\n    @ui.on(event_type=ui.EventType.EntryReturn)\n    def on_ok(self):\n        # User pressed the OK button or the Return key inside the Entry box\n        # the @on decorator can be used to bind a function to an event\n        # @on can be repeated to bind the function to multiple events\n        # set the output Label to the value of the Entry box\n        # individual widgets can be accessed by their key; the window object acts as a dictionary of widgets\n        greeting = f"Hello {self[\'entry_name\'].value}! Thanks for trying guitk."\n\n        # if you prefer, you can use get() instead of the dictionary syntax\n        self.get("output").value = greeting\n\n\nif __name__ == "__main__":\n    # instantiate your Window class and run it\n    name = HelloWorld().run()\n    print(f"Hello {name}")\n```\n\n## Documentation\n\nNot much documentation at this point.  Take a look at the [examples](https://github.com/RhetTbull/guitk/tree/main/examples) directory for a number of self-documenting examples on use of various widgets.\n\n## Testing\n\nThere are currently no automated tests as I haven\'t figured out how to do these with tkinter. I am working on adding tests and there are several tests that run with `pytest` in the `tests` directory.  These are not automated and require user interaction.\n\nYou can also run `python3 -m guitk` which opens a window with examples of all the widgets. I find this useful for quick testing of layout and widget behavior.\n\n## Contributors\n\nContributions welcome! If this project interests you, open an Issue or send a PR!\n\n## TODO\n\n* [x] Basic prototype\n* [x] Frame\n* [x] Label\n* [x] Entry\n* [x] Button\n* [x] Checkbutton\n* [x] Radiobutton\n* [x] Text\n* [x] ScrolledText\n* [x] Treeview\n* [x] Listbox\n* [x] Combobox\n* [x] Spinner\n* [ ] Other widgets\n* [ ] Menus\n* [x] Tooltips\n* [ ] Documentation\n* [x] Add docstrings\n* [x] Add type hints to public API\n* [ ] Tests\n\n## License\n\nLicensed under the MIT License.\n\n## See Also\n\n* [Textual](https://github.com/Textualize/textual) - An amazing Python framework for building user interfaces in the terminal.\n* [PySimpleGUI](https://www.PySimpleGUI.org) - A Python GUI Framework.\n* [applepy](https://github.com/eduardohleite/applepy) - A declarative GUI framework for developing native macOS applications in Python 3.\n',
    'author': 'Rhet Turnbull',
    'author_email': 'rturnbull+git@gmail.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'None',
    'packages': packages,
    'package_data': package_data,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
