TkClassWiz


NameTkClassWiz JSON
Version 1.4.10 PyPI version JSON
download
home_page
SummaryLibrary for graphically defining objects based on class annotations. Works with Tkinter / TTKBootstrap
upload_time2024-02-04 10:36:21
maintainer
docs_urlNone
authorDavid Hozic
requires_python>=3.9
license
keywords tkinter ttkbootstrap python3 objectdef classwiz classwiz gui
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========================================================
TkClassWizard
=========================================================
TkClassWizard - define objects graphically based on class annotations.
The library allows users to create abstract "ObjectInfo" objects based on the class's parameters, which
can later be converted to real Python objects and vice versa.

---------------------
Links
---------------------
- `Releases <https://github.com/davidhozic/TkClassWizard/releases>`_
- Need help? Contact me in my `Discord server <https://discord.gg/DEnvahb2Sw>`_.
- **DOCUMENTATION**: https://tkclasswizard.readthedocs.io/

---------------------
Main features
---------------------
- Interactive definition of Python objects based on annotations.
- Tkinter based
- JSON templates
- Polymorphism
- Generic classes
- Type aliases
- Data validation
- Conversion of defined data to Python objects and vice-versa.

----------------------
Installation
----------------------
TkClassWizard can be installed though command prompt/terminal using the bottom commands.
        
Pre-requirement: `Python (minimum v3.9) <https://www.python.org/downloads/>`_


.. code-block:: bash

    pip install tkclasswiz

----------------------
Example
----------------------

.. image:: docs/source/guide/images/new_define_frame_struct_new_str.png
    :width: 15cm

.. code-block:: python

    import tkinter as tk
    import tkinter.ttk as ttk
    import tkclasswiz as wiz


    # Normal Python classes with annotations (type hints)
    class Wheel:
        def __init__(self, diameter: float):
            self.diameter = diameter

    class Car:
        def __init__(self, name: str, speed: float, wheels: list[Wheel]):
            self.name = name
            self.speed = speed
            self.wheels = wheels

    # Tkinter main window
    root = tk.Tk("Test")

    # Modified tkinter Combobox that will store actual objects instead of strings
    combo = wiz.ComboBoxObjects(root)
    combo.pack(fill=tk.X, padx=5)

    def make_car(old = None):
        """
        Function for opening a window either in new definition mode (old = None) or
        edit mode (old != None)
        """
        assert old is None or isinstance(old, wiz.ObjectInfo)

        window = wiz.ObjectEditWindow()  # The object definition window / wizard
        window.open_object_edit_frame(Car, combo, old_data=old)  # Open the actual frame

    def print_defined():
        data = combo.get()
        data = wiz.convert_to_objects(data)  # Convert any abstract ObjectInfo objects into actual Python objects
        print(f"Object: {data}; Type: {type(data)}",)  # Print the object and it's datatype


    # Main GUI structure
    ttk.Button(text="Define Car", command=make_car).pack()
    ttk.Button(text="Edit Car", command=lambda: make_car(combo.get())).pack()
    ttk.Button(text="Print defined", command=print_defined).pack()
    root.mainloop()

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "TkClassWiz",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "Tkinter,TTKBootstrap,Python3,ObjectDef,ClassWiz,ClassWiz,GUI",
    "author": "David Hozic",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/4f/01/d676451e0e272c79c54a6182e89a1208e7ca1171a95939be2026738a42dc/TkClassWiz-1.4.10.tar.gz",
    "platform": null,
    "description": "=========================================================\nTkClassWizard\n=========================================================\nTkClassWizard - define objects graphically based on class annotations.\nThe library allows users to create abstract \"ObjectInfo\" objects based on the class's parameters, which\ncan later be converted to real Python objects and vice versa.\n\n---------------------\nLinks\n---------------------\n- `Releases <https://github.com/davidhozic/TkClassWizard/releases>`_\n- Need help? Contact me in my `Discord server <https://discord.gg/DEnvahb2Sw>`_.\n- **DOCUMENTATION**: https://tkclasswizard.readthedocs.io/\n\n---------------------\nMain features\n---------------------\n- Interactive definition of Python objects based on annotations.\n- Tkinter based\n- JSON templates\n- Polymorphism\n- Generic classes\n- Type aliases\n- Data validation\n- Conversion of defined data to Python objects and vice-versa.\n\n----------------------\nInstallation\n----------------------\nTkClassWizard can be installed though command prompt/terminal using the bottom commands.\n        \nPre-requirement: `Python (minimum v3.9) <https://www.python.org/downloads/>`_\n\n\n.. code-block:: bash\n\n    pip install tkclasswiz\n\n----------------------\nExample\n----------------------\n\n.. image:: docs/source/guide/images/new_define_frame_struct_new_str.png\n    :width: 15cm\n\n.. code-block:: python\n\n    import tkinter as tk\n    import tkinter.ttk as ttk\n    import tkclasswiz as wiz\n\n\n    # Normal Python classes with annotations (type hints)\n    class Wheel:\n        def __init__(self, diameter: float):\n            self.diameter = diameter\n\n    class Car:\n        def __init__(self, name: str, speed: float, wheels: list[Wheel]):\n            self.name = name\n            self.speed = speed\n            self.wheels = wheels\n\n    # Tkinter main window\n    root = tk.Tk(\"Test\")\n\n    # Modified tkinter Combobox that will store actual objects instead of strings\n    combo = wiz.ComboBoxObjects(root)\n    combo.pack(fill=tk.X, padx=5)\n\n    def make_car(old = None):\n        \"\"\"\n        Function for opening a window either in new definition mode (old = None) or\n        edit mode (old != None)\n        \"\"\"\n        assert old is None or isinstance(old, wiz.ObjectInfo)\n\n        window = wiz.ObjectEditWindow()  # The object definition window / wizard\n        window.open_object_edit_frame(Car, combo, old_data=old)  # Open the actual frame\n\n    def print_defined():\n        data = combo.get()\n        data = wiz.convert_to_objects(data)  # Convert any abstract ObjectInfo objects into actual Python objects\n        print(f\"Object: {data}; Type: {type(data)}\",)  # Print the object and it's datatype\n\n\n    # Main GUI structure\n    ttk.Button(text=\"Define Car\", command=make_car).pack()\n    ttk.Button(text=\"Edit Car\", command=lambda: make_car(combo.get())).pack()\n    ttk.Button(text=\"Print defined\", command=print_defined).pack()\n    root.mainloop()\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Library for graphically defining objects based on class annotations. Works with Tkinter / TTKBootstrap",
    "version": "1.4.10",
    "project_urls": null,
    "split_keywords": [
        "tkinter",
        "ttkbootstrap",
        "python3",
        "objectdef",
        "classwiz",
        "classwiz",
        "gui"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "488eb14983854c648c0579519039e2fc11f658bb660750cbd9cc43a7c2d24b75",
                "md5": "ead787af22623435b317cb8aeb13774a",
                "sha256": "b89197ab7d0f97dbb528ec3f8aa434be918dd14731fec5a3d040a80f46d99e6c"
            },
            "downloads": -1,
            "filename": "TkClassWiz-1.4.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ead787af22623435b317cb8aeb13774a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 38238,
            "upload_time": "2024-02-04T10:36:20",
            "upload_time_iso_8601": "2024-02-04T10:36:20.385966Z",
            "url": "https://files.pythonhosted.org/packages/48/8e/b14983854c648c0579519039e2fc11f658bb660750cbd9cc43a7c2d24b75/TkClassWiz-1.4.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f01d676451e0e272c79c54a6182e89a1208e7ca1171a95939be2026738a42dc",
                "md5": "241ac9c87e289a649edd10c9cd7fdd66",
                "sha256": "408463ec339ad119abc4bf39af02ff8311e7ce608313da7b344bfea487ee6596"
            },
            "downloads": -1,
            "filename": "TkClassWiz-1.4.10.tar.gz",
            "has_sig": false,
            "md5_digest": "241ac9c87e289a649edd10c9cd7fdd66",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 29002,
            "upload_time": "2024-02-04T10:36:21",
            "upload_time_iso_8601": "2024-02-04T10:36:21.988257Z",
            "url": "https://files.pythonhosted.org/packages/4f/01/d676451e0e272c79c54a6182e89a1208e7ca1171a95939be2026738a42dc/TkClassWiz-1.4.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-04 10:36:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "tkclasswiz"
}
        
Elapsed time: 0.53608s