textual-qrcode
Introduction
While, I admit, likely of little utility really, this library aims to show one possible way of writing and "shipping" a custom widget for Textual. Key here is that the library contains and provides a custom widget which can be imported and used in an application; but it also provides a simple application that can be run to see the widget in action.
Please note!
This library is just a thin wrapper around https://qrenco.de/. Each time you create a QR code the content you encode is sent to that website. It also means, of course, that this is only usable with a working net connection. Please keep these things in mind if you do decide to actually use this for something.
Installing
The library itself can be installed with pip:
$ pip install textual-qrcode
or with your Python environment manager of choice.
Running the test application
The demo/test application can be run like this:
$ python -m textual_qrcode
When you've finished testing, press Ctrl+C to quit.
Using the widget
To make use of the QRCode widget, import it into your code:
from textual_qrcode import QRCode
The widget itself takes all of the arguments that a normal Textual Widget
takes, but has the addition of an initial positional argument which is some
text to encode. An example use of it could look like:
def compose( self ) -> ComposeResult:
yield Header()
yield QRCode( "https://textual.textualize.io/" )
yield Footer()
The widget also has a encode method, that lets you update the QR code to
display something else. For example:
self.query_one( QRCode ).encode( "Now I've changed it to this" )
The widget will send out one of two messages when an attempt is made to
encode some content. If the content was encoded fine a QRCode.Encoded
message is sent out, which can be caught like this:
def on_qrcode_encoded( self, event: QRCode.Encoded ) -> None:
# Do something now that the QR code was updated fine.
If there is an error encoding the content QRCode.Error will be sent out.
this can be used like this:
def on_qrcode_error( self, event: QRCode.Error ) -> None:
# Do something about the error.
In both cases the event sent out has a qr_code property which is the
QRCode widget involved.
Metadata
Release files for textual-qrcode 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| textual_qrcode-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for textual_qrcode-0.2.0-py3-none-any.whl |
Release files / textual_qrcode-0.2.0-py3-none-any.whl
| Download URL | textual_qrcode-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1705547af5a7b76b25ca95ed62f6166f867147ccc9e1414c2eb377a078251a1
|
|
BLAKE2b-256 checksum How to use checksums |
08585a1b4c4ce3b039dee290f61cb8fb6c463c6ca77db8a714488d736ee808b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for textual-qrcode 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.