-
First Check
Example Codefrom nicegui import ui
ui.scanner()
ui.run DescriptionI'd like to add a bar- and qr code scanner control to my nicegui app. Are you aware of a NiceGUI control or plugin I could use for this purpose? If no such control does yet exist, how would you suggest I create one? NiceGUI Version2.19 Python Version3.12 BrowserChrome Operating SystemLinux Additional ContextI am aware of barcode scan and amazon lookup application #2028, but as far as I can tell, that NiceGUI app uploads images and scans those. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I believe a custom vue component is the nicegui way to solve this use case. I’ve done this a few times with other JS libraries (e.g. xterm.js) in the past, and it turned out to be a very elegant way to wire everything together. Here’s an example of a custom component if you need it: |
Beta Was this translation helpful? Give feedback.
-
I have packaged my experimental application, it is published on PyPi. pip install nicegui nicegui-scanner from nicegui import ui
from nicegui_scanner import BarcodeScanner
def on_scan(event):
ui.notify(f"Scanned: {event.args}")
scanner = BarcodeScanner(on_scan=on_scan)
scanner.create_controls()
ui.run() ![]() |
Beta Was this translation helpful? Give feedback.
I believe a custom vue component is the nicegui way to solve this use case. I’ve done this a few times with other JS libraries (e.g. xterm.js) in the past, and it turned out to be a very elegant way to wire everything together.
Here’s an example of a custom component if you need it:
https://github.com/zauberzeug/nicegui/tree/main/examples/custom_vue_component