{"id":17897761,"url":"https://github.com/j-city/tinywintoast","last_synced_at":"2025-03-23T07:34:49.469Z","repository":{"id":57475788,"uuid":"197578031","full_name":"J-CITY/tinyWinToast","owner":"J-CITY","description":"Tiny library to show windows toast","archived":false,"fork":false,"pushed_at":"2025-02-28T10:06:25.000Z","size":1259,"stargazers_count":25,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T18:57:37.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/J-CITY.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-18T11:56:52.000Z","updated_at":"2025-02-28T10:06:29.000Z","dependencies_parsed_at":"2022-09-07T17:12:46.849Z","dependency_job_id":null,"html_url":"https://github.com/J-CITY/tinyWinToast","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-CITY%2FtinyWinToast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-CITY%2FtinyWinToast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-CITY%2FtinyWinToast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-CITY%2FtinyWinToast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/J-CITY","download_url":"https://codeload.github.com/J-CITY/tinyWinToast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245072301,"owners_count":20556353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T15:15:15.789Z","updated_at":"2025-03-23T07:34:49.449Z","avatar_url":"https://github.com/J-CITY.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyWinToast\n\n:email: Tiny library to show windows toast\n\n# Description\nI want use notification in my console player, but I want more powerful toast then in [win10toast](https://github.com/jithurjacob/Windows-10-Toast-Notifications \"win10toast\"),\nso I write this lib.\n\n# Installation\n\npip install tinyWinToast\n\n# Examples:\n\nSee source code to get more information\n\nSimple start:\n\nTo create simple toast:\n\n```python\ngetToast(\"Title\", \"Message\", 'icon.jpg', crop=\"circle\", duration=\"short\", appId=\"MyApp\", isMute=True).show()\n```\n\nOr you can create toast object\n\nNew# Button and Inputs callback (WIP)\nTODO: Need way run PS1 script and not close the process\n```python\n# Load PoshWinRT.dll for catch events from toasts\n# Init supporn get info from toast actions (if param is True)\n# Init PowerShell process\nToastInit(True) \n\ntoast = Toast()\n # Set that if want get information from toast acction\ntoast.config.USE_ACTIONS_CALLBACK = True\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addButton(\n    Button(content=\"Button\", activationType=ACTION_TYPE_BACKGROUND,\n           arguments=\"Button\", pendingUpdate=False))\ntoast.addInput(Input(inputId=\"Text\", intype=INPUT_TEXT, placeHolderContent=\"Input text...\"))\ntoast.addInput(Input(inputId=\"Select\", intype=INPUT_SELECTION, selections = [(\"1\",\"Yes\"), (\"2\",\"No\"), (\"3\",\"Maybe\")], defaultInput=\"1\"))\ntoast.show()\n\ntime.sleep(9)\n\n# Get toasts actions as string list\nprint(toast.getEventListenerOutput())\n\n# Deinit all\nToastDeinit()\n```\n\n\n0# Simple toast\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=2)\ntoast.setMessage(\"MESSAGE\", maxLines=2)\ntoast.setIcon('image.png', crop=CROP_NONE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/0.png)\n\n1# More text and circle crop\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addText(\"MORE TEXT\", maxLines=1)\ntoast.setIcon('image.png', crop=CROP_CIRCLE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/1.png)\n\n2# Add hero image\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addText(\"MORE TEXT\", maxLines=1)\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.setHeroImage(\"heroimage.jpg\")\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/2.png)\n\n3# Add image\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addText(\"MORE TEXT\", maxLines=1)\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.setImage(\"image.jpg\")\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/3.png)\n\n4# More images\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addText(\"MORE TEXT\", maxLines=1)\ntoast.setIcon('image.jpg', crop=CROP_CIRCLE)\ntoast.addImage(\"image.jpg\")\ntoast.addImage(\"image.jpg\")\ntoast.addImage(\"image.jpg\")\ntoast.addImage(\"image.jpg\")\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/4.png)\n\n5# Text attribute\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addText(\"from email\", placement=\"attribution\", maxLines=1)\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/5.png)\n\n6# Toast time \n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.setTime(\"2019-07-13T18:49:37.00Z\")\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/6.png)\n\n7# Add group text\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addGroupText(\"Message\", maxLines=1, style=TEXT_STYLE_BASE, align=TEXT_ALIGN_LEFT)\ntoast.addGroupText(\"Message\", maxLines=1, style=TEXT_STYLE_CAPTION_SUBTLE, align=TEXT_ALIGN_LEFT)\ntoast.addGroupText(\"Message\", maxLines=1, style=TEXT_STYLE_BASE, align=TEXT_ALIGN_RIGHT)\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/7.png)\n\n8# Toast progress\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addProgress(Progress(title=\"Title\", value=\"0.6\", valueStringOverride=\"15/20\", status=\"Save...\"))\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/8.png)\n\nUpdate toast data\n\n```puthon\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.setTag(\"mytag\")\ntoast.setGroup(\"mygroup\")\ntoast.setProgress(Progress(title=\"Title\", value=\"0.2\", valueStringOverride=\"15/20\", status=\"Save...\"))\ntoast.setIcon('icon.jpg', crop=CROP_NONE)\ntoast.show()\n\ntime.sleep(6)\n\ntoast.setProgress(Progress(title=\"Title\", value=\"0.9\", valueStringOverride=\"19/20\", status=\"Save...\"))\nd = {'progressValue': \"0.9\", 'progressValueString': \"19/20\"}\n#toast.show() # if you wand update all toast\ntoast.update(200, d)\nToastDeinit()\n```\n\n9# Buttons and inputs\n\n```python\nToastInit(False)\ntoast = Toast()\ntoast.setTitle(\"TITLE\", maxLines=1)\ntoast.setMessage(\"MESSAGE\", maxLines=1)\ntoast.addInput(Input(inputId=\"111\", intype=INPUT_TEXT, placeHolderContent=\"Input text...\"))\ntoast.addInput(Input(inputId=\"112\", intype=INPUT_SELECTION, selections = [(\"1\",\"Yes\"), (\"2\",\"No\"), (\"3\",\"Maybe\")], defaultInput=\"1\"))\ntoast.addButton(Button(content=\"Play\", activationType=ACTION_TYPE_BACKGROUND, arguments=\"dismiss\", pendingUpdate=False))\ntoast.addButton(Button(content=\"Pause\", activationType=ACTION_TYPE_BACKGROUND, arguments=\"http://www.google.com\", pendingUpdate=False))\ntoast.setIcon('icon.jpg', crop=CROP_CIRCLE)\ntoast.show()\nToastDeinit()\n```\n\n![Imgur](https://github.com/J-CITY/TinyWinToast/blob/master/screens/9.png)\n\nAlso, you can load toast from script, or xml\n\n```python\nToastInit(False)\ntoast.showFromXml(\"APP_ID\", \"XML_STRING\")\ntoast.startFromScript(path_to_script.ps1)\ntoast.updateFromScript(path_to_script.ps1)\nToastDeinit()\n```\n\nAlso you can creage Config() and set some params\n```python\nToastInit(False)\nconfig = Config()\nconfig.APP_ID = \"myApp\"\nconfig.DURATION = DURATION_LONG\n...\ntoast = Toast(config)\nToastDeinit()\n```\n\nor \n\n```python\nToastInit(False)\nconfig = Config()\nconfig.APP_ID = \"myApp\"\nconfig.DURATION = DURATION_LONG\n...\ntoast = Toast()\ntoast.setConfig(config)\nToastDeinit()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-city%2Ftinywintoast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-city%2Ftinywintoast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-city%2Ftinywintoast/lists"}