EventSimpleGUI


NameEventSimpleGUI JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/MikalROn/EventSimpleGUI
SummaryA simple tool to create events to PySimpleGUI
upload_time2023-07-17 01:17:29
maintainer
docs_urlNone
authorDaniel Coêlho
requires_python>=3
licenseMIT license
keywords eventsimplegui eventsimplegui simplegui gui gui events for simplegui event handler simple gui generate events fast events events
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Events For SimpleGui

> Status of project: in progress...


<div align="center">

![GitHub](https://img.shields.io/github/license/MikalROn/EventSimpleGUI?style=for-the-badge)
![PyPI - Downloads](https://img.shields.io/pypi/dm/eventsimplegui?style=for-the-badge)
<a href="https://github.com/MikalROn/EventSimpleGUI">
<img alt="GitHub" src="https://img.shields.io/badge/Github-Open%20source-green?style=for-the-badge&amp;logo=github"/>
</a>
<a href="https://smokeshow.helpmanual.io/474z2x1c0s2u3j101i26/">
<img alt="Conv100%" src="https://img.shields.io/badge/coverage-100%25-green?style=for-the-badge">
</a>
</div>

<em>This project has the intention to make easier, scalable and readable events on PySimpleGUI</em>

## Download

<p>Download from PyPi</p>

````shell
$pip install EventSimpleGUI
````

## Demonstration

<h3> Creating an event function </h3>

<p>Using the decorator event to run an event, you can pass the element key as an argument for decorator, when the event 
is called, function is going to be called two</p>

````python
from pysimpleevent import EventSimpleGUI
import PySimpleGUI as sg

loop = EventSimpleGUI()


@loop.event('_click')
def when_btn_was_clicked(*ags):
    print('Just a normal event')

layout = [[sg.B('Just a button', key='_click')]]
window = sg.Window('Just a Window.', layout)

if __name__ == '__main__':
    loop.run_window(window)
````
Events can be passed as an argument of run window like in the exemple
````python
from pysimpleevent import EventSimpleGUI
import PySimpleGUI as sg

loop = EventSimpleGUI()



def when_btn_was_clicked(*args):
    event, _, _ = args
    if event == '_click':
        print('Just a normal event')

layout = [[sg.B('Just a button', key='_click')]]
window = sg.Window('Just a Window.', layout)

if __name__ == '__main__':
    loop.run_window(window, when_btn_was_clicked)
````
And can also pass an event using add_event
````python
from pysimpleevent import EventSimpleGUI
import PySimpleGUI as sg

loop = EventSimpleGUI()



def when_btn_was_clicked(*args):
    event, _, _ = args
    if event == '_click':
        print('Just a normal event')

loop.add_event(when_btn_was_clicked)
layout = [[sg.B('Just a button', key='_click')]]
window = sg.Window('Just a Window.', layout)

if __name__ == '__main__':
    loop.run_window(window)
````

## Events

<p> You can use a sting or list of keys to trigger your events </p>

````python
from pysimpleevent import EventSimpleGUI
import PySimpleGUI as sg


loop = EventSimpleGUI()

keys = ['_click', '_click1']
@loop.event(keys)
def when_btn_was_clicked(*args):
    print('Just a normal event')


layout = [
    [sg.B(f'{"Just a button":54}', key='_click')],
    [sg.B(f'{"Just another button":50}', key='_click1')]
]
window = sg.Window('Just a Window.', layout, scaling=1.5)
if __name__ == '__main__':
    loop.run_window(window, window_log=True)
````
<div>


#### Change log 0.2.7

- Tests are implemented 97% cov
- Close event replaced to the end of loop

####  Change log 0.2.5

- Now events can return values on Values dict

</div>





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MikalROn/EventSimpleGUI",
    "name": "EventSimpleGUI",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "eventsimplegui,EventSimpleGUI,simplegui,GUI,gui,events for simplegui,event handler simple gui,generate events,fast events,events",
    "author": "Daniel Co\u00ealho",
    "author_email": "heromon.9010@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8f/1e/0f2e66006e55ad217efd67e2ec7d5a49c86f95498f7a4ddfc56308e03cba/EventSimpleGUI-0.3.1.tar.gz",
    "platform": null,
    "description": "# Events For SimpleGui\n\n> Status of project: in progress...\n\n\n<div align=\"center\">\n\n![GitHub](https://img.shields.io/github/license/MikalROn/EventSimpleGUI?style=for-the-badge)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/eventsimplegui?style=for-the-badge)\n<a href=\"https://github.com/MikalROn/EventSimpleGUI\">\n<img alt=\"GitHub\" src=\"https://img.shields.io/badge/Github-Open%20source-green?style=for-the-badge&amp;logo=github\"/>\n</a>\n<a href=\"https://smokeshow.helpmanual.io/474z2x1c0s2u3j101i26/\">\n<img alt=\"Conv100%\" src=\"https://img.shields.io/badge/coverage-100%25-green?style=for-the-badge\">\n</a>\n</div>\n\n<em>This project has the intention to make easier, scalable and readable events on PySimpleGUI</em>\n\n## Download\n\n<p>Download from PyPi</p>\n\n````shell\n$pip install EventSimpleGUI\n````\n\n## Demonstration\n\n<h3> Creating an event function </h3>\n\n<p>Using the decorator event to run an event, you can pass the element key as an argument for decorator, when the event \nis called, function is going to be called two</p>\n\n````python\nfrom pysimpleevent import EventSimpleGUI\nimport PySimpleGUI as sg\n\nloop = EventSimpleGUI()\n\n\n@loop.event('_click')\ndef when_btn_was_clicked(*ags):\n    print('Just a normal event')\n\nlayout = [[sg.B('Just a button', key='_click')]]\nwindow = sg.Window('Just a Window.', layout)\n\nif __name__ == '__main__':\n    loop.run_window(window)\n````\nEvents can be passed as an argument of run window like in the exemple\n````python\nfrom pysimpleevent import EventSimpleGUI\nimport PySimpleGUI as sg\n\nloop = EventSimpleGUI()\n\n\n\ndef when_btn_was_clicked(*args):\n    event, _, _ = args\n    if event == '_click':\n        print('Just a normal event')\n\nlayout = [[sg.B('Just a button', key='_click')]]\nwindow = sg.Window('Just a Window.', layout)\n\nif __name__ == '__main__':\n    loop.run_window(window, when_btn_was_clicked)\n````\nAnd can also pass an event using add_event\n````python\nfrom pysimpleevent import EventSimpleGUI\nimport PySimpleGUI as sg\n\nloop = EventSimpleGUI()\n\n\n\ndef when_btn_was_clicked(*args):\n    event, _, _ = args\n    if event == '_click':\n        print('Just a normal event')\n\nloop.add_event(when_btn_was_clicked)\nlayout = [[sg.B('Just a button', key='_click')]]\nwindow = sg.Window('Just a Window.', layout)\n\nif __name__ == '__main__':\n    loop.run_window(window)\n````\n\n## Events\n\n<p> You can use a sting or list of keys to trigger your events </p>\n\n````python\nfrom pysimpleevent import EventSimpleGUI\nimport PySimpleGUI as sg\n\n\nloop = EventSimpleGUI()\n\nkeys = ['_click', '_click1']\n@loop.event(keys)\ndef when_btn_was_clicked(*args):\n    print('Just a normal event')\n\n\nlayout = [\n    [sg.B(f'{\"Just a button\":54}', key='_click')],\n    [sg.B(f'{\"Just another button\":50}', key='_click1')]\n]\nwindow = sg.Window('Just a Window.', layout, scaling=1.5)\nif __name__ == '__main__':\n    loop.run_window(window, window_log=True)\n````\n<div>\n\n\n#### Change log 0.2.7\n\n- Tests are implemented 97% cov\n- Close event replaced to the end of loop\n\n####  Change log 0.2.5\n\n- Now events can return values on Values dict\n\n</div>\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "A simple tool to create events to PySimpleGUI",
    "version": "0.3.1",
    "project_urls": {
        "Demos": "https://github.com/MikalROn/EventSimpleGUI/tree/main/demos",
        "Docs": "https://mikalron.github.io/EventSimpleGUI/",
        "Homepage": "https://github.com/MikalROn/EventSimpleGUI",
        "Source": "https://github.com/MikalROn/EventSimpleGUI",
        "Tests": "https://smokeshow.helpmanual.io/474z2x1c0s2u3j101i26/"
    },
    "split_keywords": [
        "eventsimplegui",
        "eventsimplegui",
        "simplegui",
        "gui",
        "gui",
        "events for simplegui",
        "event handler simple gui",
        "generate events",
        "fast events",
        "events"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f1e0f2e66006e55ad217efd67e2ec7d5a49c86f95498f7a4ddfc56308e03cba",
                "md5": "a7a59fc8c2bfd00980e24ad0b40ff49e",
                "sha256": "8df93d97f3ca47acf6b273c71f4cbc211f14b2f2ac4f36e3531eab1ab8924cca"
            },
            "downloads": -1,
            "filename": "EventSimpleGUI-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a7a59fc8c2bfd00980e24ad0b40ff49e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 4194,
            "upload_time": "2023-07-17T01:17:29",
            "upload_time_iso_8601": "2023-07-17T01:17:29.059965Z",
            "url": "https://files.pythonhosted.org/packages/8f/1e/0f2e66006e55ad217efd67e2ec7d5a49c86f95498f7a4ddfc56308e03cba/EventSimpleGUI-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-17 01:17:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MikalROn",
    "github_project": "EventSimpleGUI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "eventsimplegui"
}
        
Elapsed time: 0.09594s