{"id":15578138,"url":"https://github.com/davep/textual-qrcode","last_synced_at":"2025-10-07T06:32:30.869Z","repository":{"id":63914566,"uuid":"571709835","full_name":"davep/textual-qrcode","owner":"davep","description":"ian-malcolm-scientists.gif","archived":false,"fork":false,"pushed_at":"2023-02-18T18:26:36.000Z","size":90,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-20T06:59:23.220Z","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/davep.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":"2022-11-28T18:11:08.000Z","updated_at":"2024-12-04T01:58:12.000Z","dependencies_parsed_at":"2023-02-12T12:10:15.678Z","dependency_job_id":null,"html_url":"https://github.com/davep/textual-qrcode","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davep%2Ftextual-qrcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davep%2Ftextual-qrcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davep%2Ftextual-qrcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davep%2Ftextual-qrcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davep","download_url":"https://codeload.github.com/davep/textual-qrcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235600038,"owners_count":19016193,"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-02T19:06:14.694Z","updated_at":"2025-10-07T06:32:25.519Z","avatar_url":"https://github.com/davep.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# textual-qrcode\n\n## Introduction\n\nWhile, I admit, likely of little utility really, this library aims to show\none possible way of writing and \"shipping\" a custom widget for\n[Textual](https://textual.textualize.io/). Key here is that the library\ncontains and provides a custom widget which can be imported and used in an\napplication; but it also provides a simple application that can be run to\nsee the widget in action.\n\n## Please note!\n\nThis library is just a thin wrapper around \u003chttps://qrenco.de/\u003e. Each time\nyou create a QR code the content you encode is sent to that website. It also\nmeans, of course, that this is only usable with a working net connection.\nPlease keep these things in mind if you do decide to actually use this for\nsomething.\n\n## Installing\n\nThe library itself can be installed with `pip`:\n\n```sh\n$ pip install textual-qrcode\n```\n\nor with your Python environment manager of choice.\n\n## Running the test application\n\nThe demo/test application can be run like this:\n\n```sh\n$ python -m textual_qrcode\n```\n\nWhen you've finished testing, press \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eC\u003c/kbd\u003e to quit.\n\n## Using the widget\n\nTo make use of the `QRCode` widget, import it into your code:\n\n```python\nfrom textual_qrcode import QRCode\n```\n\nThe widget itself takes all of the arguments that a normal Textual `Widget`\ntakes, but has the addition of an initial positional argument which is some\ntext to encode. An example use of it could look like:\n\n```python\n    def compose( self ) -\u003e ComposeResult:\n        yield Header()\n        yield QRCode( \"https://textual.textualize.io/\" )\n        yield Footer()\n```\n\nThe widget also has a `encode` method, that lets you update the QR code to\ndisplay something else. For example:\n\n```python\nself.query_one( QRCode ).encode( \"Now I've changed it to this\" )\n```\n\nThe widget will send out one of two messages when an attempt is made to\nencode some content. If the content was encoded fine a `QRCode.Encoded`\nmessage is sent out, which can be caught like this:\n\n```python\ndef on_qrcode_encoded( self, event: QRCode.Encoded ) -\u003e None:\n    # Do something now that the QR code was updated fine.\n```\n\nIf there is an error encoding the content `QRCode.Error` will be sent out.\nthis can be used like this:\n\n```python\ndef on_qrcode_error( self, event: QRCode.Error ) -\u003e None:\n    # Do something about the error.\n```\n\nIn both cases the event sent out has a `qr_code` property which is the\n`QRCode` widget involved.\n\n[//]: # (README.md ends here)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavep%2Ftextual-qrcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavep%2Ftextual-qrcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavep%2Ftextual-qrcode/lists"}