{ "info": { "author": "Nikita Mochalov", "author_email": "mochalov.n@ya.ru", "bugtrack_url": null, "classifiers": [], "description": "# Webevents\nA little, zero-dependency Python library for making simple HTML/JS GUI apps\n## Installation\nNote that only Python >= 3.6 is supported\n```\npip install webevents\n```\n## Example: ping-pong\nPython sends a number to Javascript, which outputs it out to console, increments it and sends the number back to Python for displaying in terminal. And so on.\n\nWe will have the directory structure presented below. Generally speaking, In the \"web\" folder you can put your HTML/CSS/JS application. \"Ping-pong\" application will only consist of one \"index.html\" file.\n\n```\n\u251c\u2500\u2500 example.py\n\u2514\u2500\u2500 web\n \u2514\u2500\u2500 index.html\n```\n**index.html:**\n```html\n\n\n\n \n \n Webevents \"Ping-pong\"\n \n \n\n\n Demonstration in console\n \n\n\n```\n\n**example.py:**\n```python\nimport webbrowser\nimport webevents\n\ndef pong_callback(number):\n print(number)\n snakes_events.fire_event(\"ping\", int(number) + 1)\n\naddress = (\"localhost\", 8080)\nsnakes_events = webevents.run(address, \"web\")\nsnakes_events.add_termination_callback(lambda: print(\"The end!\"))\nsnakes_events.add_event_listener(\"pong\", pong_callback)\n\nwebbrowser.open_new_tab(\"http://{}:{}\".format(*address))\n\n# initial ping\nsnakes_events.fire_event(\"ping\", 0)\n\ntry:\n while True:\n pass\nexcept KeyboardInterrupt:\n snakes_events.terminate()\n```\n\nMultiple callbacks are supported. You can remove events with:\n+ `remove_event_listener(event_type, callback)` in Python\n+ `removeEventListener(event_type, callback)` in JS\n\nIn Python you can add termination callbacks with `add_termination_callback(callback)`. It may be useful in multi process applications. Note that there is no need to add termination callbacks if you don't need them.\n\nUsually termination is occurred when user closes the browser page. But you can disable this by passing `timeout=None` in `webevents.run()`. You always can terminate the \"webevents\" with `webevents.terminate()`.\n\n**Javascript output:**\n```\n0 2 4 6 8 10 12 ...\n```\n**Python output:**\n```\n1 3 5 7 9 11 13 ... The end!\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Zamony/webevents", "keywords": "gui html js events eel electron", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "webevents", "package_url": "https://pypi.org/project/webevents/", "platform": "", "project_url": "https://pypi.org/project/webevents/", "project_urls": { "Homepage": "https://github.com/Zamony/webevents" }, "release_url": "https://pypi.org/project/webevents/0.1.4/", "requires_dist": null, "requires_python": "~=3.6", "summary": "A little Python library for making simple HTML/JS GUI apps", "version": "0.1.4" }, "last_serial": 4114197, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "2dcac9ba76d7669fb7e2280013b4cf8d", "sha256": "363ace6a818d17a43cfd7d03434e5100cc8adfc75ed85f21b608145d51239ff7" }, "downloads": -1, "filename": "webevents-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "2dcac9ba76d7669fb7e2280013b4cf8d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 4960, "upload_time": "2018-07-07T10:11:05", "url": "https://files.pythonhosted.org/packages/e6/a8/d102cf6c141aaaf6402ffb15319e683433e3625eaddb0699bdd88b21fcf9/webevents-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2539f0f4118510b6ad6756528763fba0", "sha256": "adf54d2e9d474fc2adc24ba24ed2c8ce6c92ce7d7a552ff887455e905534b05c" }, "downloads": -1, "filename": "webevents-0.1.3.tar.gz", "has_sig": false, "md5_digest": "2539f0f4118510b6ad6756528763fba0", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4500, "upload_time": "2018-07-07T10:11:07", "url": "https://files.pythonhosted.org/packages/5e/e1/d63a087567215884b7eccae10e5665c0e03c8b096ac19bc2e2121c013f4d/webevents-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "0fa664f376e0759af60c7c2c453efeae", "sha256": "de9a1139b9ffb81bef5c96e8fc0d757804b8c00d176c3d054d71df014c9ed224" }, "downloads": -1, "filename": "webevents-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "0fa664f376e0759af60c7c2c453efeae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 4958, "upload_time": "2018-07-29T18:16:15", "url": "https://files.pythonhosted.org/packages/d0/d7/812a86eab444bcb13b90066564026946ad0d94c17ad9f001c86927e6c64a/webevents-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a2b0cbf98b55668fceebec2e8baa571a", "sha256": "1920ec15b3086ff4b2128d0ec724b8939e04c40fb2881fdfa7f6a79e54f531df" }, "downloads": -1, "filename": "webevents-0.1.4.tar.gz", "has_sig": false, "md5_digest": "a2b0cbf98b55668fceebec2e8baa571a", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4499, "upload_time": "2018-07-29T18:16:16", "url": "https://files.pythonhosted.org/packages/c2/3a/8f2cf3bc4f8239320bef5726c5c4c20a5ad4c689b4f559d3571038f84037/webevents-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0fa664f376e0759af60c7c2c453efeae", "sha256": "de9a1139b9ffb81bef5c96e8fc0d757804b8c00d176c3d054d71df014c9ed224" }, "downloads": -1, "filename": "webevents-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "0fa664f376e0759af60c7c2c453efeae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 4958, "upload_time": "2018-07-29T18:16:15", "url": "https://files.pythonhosted.org/packages/d0/d7/812a86eab444bcb13b90066564026946ad0d94c17ad9f001c86927e6c64a/webevents-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a2b0cbf98b55668fceebec2e8baa571a", "sha256": "1920ec15b3086ff4b2128d0ec724b8939e04c40fb2881fdfa7f6a79e54f531df" }, "downloads": -1, "filename": "webevents-0.1.4.tar.gz", "has_sig": false, "md5_digest": "a2b0cbf98b55668fceebec2e8baa571a", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4499, "upload_time": "2018-07-29T18:16:16", "url": "https://files.pythonhosted.org/packages/c2/3a/8f2cf3bc4f8239320bef5726c5c4c20a5ad4c689b4f559d3571038f84037/webevents-0.1.4.tar.gz" } ] }