pyappframework


Namepyappframework JSON
Version 0.0.dev0 PyPI version JSON
download
home_page
SummaryA small example package
upload_time2023-12-18 08:09:25
maintainer
docs_urlNone
author
requires_python>=3.9
licenseBSD 3-Clause License Copyright (c) 2023, Minsu Kwon (kms1212) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords gui application framework wxwidgets wxpython
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyApplicationFramework

## Introduction
The PyApplicationFramework is a set of library wrappers related to application development in Python.
This framework allows developers to write a GUI application more simply, with a programming paradigm similar to SwiftUI.
The declarative syntax of User Interface markup, inspired by SwiftUI, is one of the critical functionalities in this project.

## A Basic "Hello, World!" Code with Explanation
```python
import wx

class HelloWorldFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        self.SetTitle("HelloWorldWindow")
        panel = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)
        text = wx.StaticText(panel, label="Hello, World!")
        sizer.Add(text)
        panel.SetSizer(sizer)

if __name__ == "__main__":
    app = wx.App()
    frame = HelloWorldFrame(None)
    frame.Show()
    app.MainLoop()
```
The code above creates a simple window with an text "Hello, World!" at the top-left corner of it as shown as the image below:
![helloworld](doc/images/helloworld.png)

The code below written with PyApplicationFramework is a code which shows the same result:
```python
import wx
from pyappframework.ui import Window
from pyappframework.ui.controls import Panel, StaticText

class HelloWorldWindow(Window):
    def __init__(self, *args, **kw):
        super().__init__(*args, **kw)
        self.SetTitle("HelloWorldWindow")

    def body(self) -> Panel:
        return (
            Panel(wx.BoxSizer(wx.VERTICAL))
                .body [[
                StaticText(label="Hello, World!")
            ]]
        )

if __name__ == "__main__":
    app = wx.App()
    frame = HelloWorldWindow()
    frame.Show()
    app.MainLoop()
```

As you can see, you can recognize the hierarchical structures of the UI, without using external markup language (like [XRC](https://docs.wxpython.org/wx.xrc.1moduleindex.html)), which is still needed to instantiate every single control defined inside of it.

## Mutable Values
Mutations of a variable or an attribute defined by `class Mutable[]()` can be observed by adding an event handler or synchronized to one or more attributes of the views or controls.

```python
import wx
import pyappframework as pyaf
from pyappframework import ui
from pyappframework.ui import controls as ctl

class MutableWindow(ui.Window):
    def __init__(self, *args, **kw):
        self.textbox_value = pyaf.Mutable[str]("Initial value")
        super().__init__(*args, **kw)
        self.SetTitle("MutableWindow")

    def body(self) -> ctl.Panel:
        return (
            ctl.ScrollablePanel(wx.BoxSizer(wx.VERTICAL))
            .body [[
                ctl.StaticText(label=self.textbox_value)
                    .sizer(wx.SizerFlags().Border(wx.TOP | wx.LEFT)),
                ctl.TextCtrl(value=self.textbox_value)
                    .sizer(proportion=0, flag=wx.EXPAND),
                ctl.SearchCtrl(value=self.textbox_value)
                    .sizer(proportion=0, flag=wx.EXPAND),
            ]]
        )

if __name__ == "__main__":
    app = wx.App()
    frame = MutableWindow()
    frame.Show()
    app.MainLoop()
```
![mutable](doc/images/mutable.gif)

## Default Controls
- Button
- CheckBox
- Choice
- CollapsiblePanel
- Control
- DataViewCtrl
- Gauge
- InfoBar
- ListBox
- Notebook
- Panel
- Plot
- ScrollablePanel
- SearchCtrl
- SplitterWindow
- StaticBitmap
- StaticBox
- StaticLine
- StaticText
- TextCtrl
- ToolBar
- TreeCtrl
- WebView

## Controls with Additional Requirements
- GLCanvas (PyOpenGL)
- Plot (matplotlib)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyappframework",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "gui,application,framework,wxwidgets,wxpython",
    "author": "",
    "author_email": "kms1212 <kms1212g@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/11/2d/8f40265bc8a5606dc6edb798899c866bb2f0faa95fd995d54bb493a670f9/pyappframework-0.0.dev0.tar.gz",
    "platform": null,
    "description": "# PyApplicationFramework\n\n## Introduction\nThe PyApplicationFramework is a set of library wrappers related to application development in Python.\nThis framework allows developers to write a GUI application more simply, with a programming paradigm similar to SwiftUI.\nThe declarative syntax of User Interface markup, inspired by SwiftUI, is one of the critical functionalities in this project.\n\n## A Basic \"Hello, World!\" Code with Explanation\n```python\nimport wx\n\nclass HelloWorldFrame(wx.Frame):\n    def __init__(self, parent):\n        wx.Frame.__init__(self, parent)\n        self.SetTitle(\"HelloWorldWindow\")\n        panel = wx.Panel(self)\n        sizer = wx.BoxSizer(wx.VERTICAL)\n        text = wx.StaticText(panel, label=\"Hello, World!\")\n        sizer.Add(text)\n        panel.SetSizer(sizer)\n\nif __name__ == \"__main__\":\n    app = wx.App()\n    frame = HelloWorldFrame(None)\n    frame.Show()\n    app.MainLoop()\n```\nThe code above creates a simple window with an text \"Hello, World!\" at the top-left corner of it as shown as the image below:\n![helloworld](doc/images/helloworld.png)\n\nThe code below written with PyApplicationFramework is a code which shows the same result:\n```python\nimport wx\nfrom pyappframework.ui import Window\nfrom pyappframework.ui.controls import Panel, StaticText\n\nclass HelloWorldWindow(Window):\n    def __init__(self, *args, **kw):\n        super().__init__(*args, **kw)\n        self.SetTitle(\"HelloWorldWindow\")\n\n    def body(self) -> Panel:\n        return (\n            Panel(wx.BoxSizer(wx.VERTICAL))\n                .body [[\n                StaticText(label=\"Hello, World!\")\n            ]]\n        )\n\nif __name__ == \"__main__\":\n    app = wx.App()\n    frame = HelloWorldWindow()\n    frame.Show()\n    app.MainLoop()\n```\n\nAs you can see, you can recognize the hierarchical structures of the UI, without using external markup language (like [XRC](https://docs.wxpython.org/wx.xrc.1moduleindex.html)), which is still needed to instantiate every single control defined inside of it.\n\n## Mutable Values\nMutations of a variable or an attribute defined by `class Mutable[]()` can be observed by adding an event handler or synchronized to one or more attributes of the views or controls.\n\n```python\nimport wx\nimport pyappframework as pyaf\nfrom pyappframework import ui\nfrom pyappframework.ui import controls as ctl\n\nclass MutableWindow(ui.Window):\n    def __init__(self, *args, **kw):\n        self.textbox_value = pyaf.Mutable[str](\"Initial value\")\n        super().__init__(*args, **kw)\n        self.SetTitle(\"MutableWindow\")\n\n    def body(self) -> ctl.Panel:\n        return (\n            ctl.ScrollablePanel(wx.BoxSizer(wx.VERTICAL))\n            .body [[\n                ctl.StaticText(label=self.textbox_value)\n                    .sizer(wx.SizerFlags().Border(wx.TOP | wx.LEFT)),\n                ctl.TextCtrl(value=self.textbox_value)\n                    .sizer(proportion=0, flag=wx.EXPAND),\n                ctl.SearchCtrl(value=self.textbox_value)\n                    .sizer(proportion=0, flag=wx.EXPAND),\n            ]]\n        )\n\nif __name__ == \"__main__\":\n    app = wx.App()\n    frame = MutableWindow()\n    frame.Show()\n    app.MainLoop()\n```\n![mutable](doc/images/mutable.gif)\n\n## Default Controls\n- Button\n- CheckBox\n- Choice\n- CollapsiblePanel\n- Control\n- DataViewCtrl\n- Gauge\n- InfoBar\n- ListBox\n- Notebook\n- Panel\n- Plot\n- ScrollablePanel\n- SearchCtrl\n- SplitterWindow\n- StaticBitmap\n- StaticBox\n- StaticLine\n- StaticText\n- TextCtrl\n- ToolBar\n- TreeCtrl\n- WebView\n\n## Controls with Additional Requirements\n- GLCanvas (PyOpenGL)\n- Plot (matplotlib)\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2023, Minsu Kwon (kms1212)  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "A small example package",
    "version": "0.0.dev0",
    "project_urls": {
        "Homepage": "https://github.com/kms1212/pyApplicationFramework",
        "Issues": "https://github.com/kms1212/pyApplicationFramework/issues"
    },
    "split_keywords": [
        "gui",
        "application",
        "framework",
        "wxwidgets",
        "wxpython"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "057703623da14ccdf5adf3593a5508e0728acb7fa40642f691211615f280eb16",
                "md5": "1016dbb747ea1c0f14f33084451cf69e",
                "sha256": "3100e80ae8045a8f5a64a76444475aa5b7ac403bc8bf86677fcc9f0d3698d840"
            },
            "downloads": -1,
            "filename": "pyappframework-0.0.dev0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1016dbb747ea1c0f14f33084451cf69e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 25410,
            "upload_time": "2023-12-18T08:09:23",
            "upload_time_iso_8601": "2023-12-18T08:09:23.809979Z",
            "url": "https://files.pythonhosted.org/packages/05/77/03623da14ccdf5adf3593a5508e0728acb7fa40642f691211615f280eb16/pyappframework-0.0.dev0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "112d8f40265bc8a5606dc6edb798899c866bb2f0faa95fd995d54bb493a670f9",
                "md5": "de4d275ce5430bfc7b56c6d9326f5fe0",
                "sha256": "05f167456ba69a4825c38f3dd939578d80a49ae1d1861b214a587018b113f7d1"
            },
            "downloads": -1,
            "filename": "pyappframework-0.0.dev0.tar.gz",
            "has_sig": false,
            "md5_digest": "de4d275ce5430bfc7b56c6d9326f5fe0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 216106,
            "upload_time": "2023-12-18T08:09:25",
            "upload_time_iso_8601": "2023-12-18T08:09:25.780731Z",
            "url": "https://files.pythonhosted.org/packages/11/2d/8f40265bc8a5606dc6edb798899c866bb2f0faa95fd995d54bb493a670f9/pyappframework-0.0.dev0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-18 08:09:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kms1212",
    "github_project": "pyApplicationFramework",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyappframework"
}
        
Elapsed time: 0.16285s