kivy QR_Reader
by keirvt from LinuxQuestions.org on (#5K763)
My OS is Linux Mint Tricia. My camera /dev/video0 works with cheese and opencv.
Common code to use python kivy to act as a QR code reader is;
Code:from kivy.app import App
from kivy.lang import Builder
import kivy_garden.zbarcam
DEMO_APP_KV_LANG = """
BoxLayout:
orientation: 'vertical'
ZBarCam:
id: zbarcam
code_types: 'qrcode', 'ean13'
Label:
size_hint: None, None
size: self.texture_size[0], 50
text: 'test: ' + ', '.join([str(symbol.data) for symbol in zbarcam.symbols])
"""
class DemoApp(App):
def build(self):
return Builder.load_string(DEMO_APP_KV_LANG)
if __name__ == '__main__':
DemoApp().run()If I run this using python3 I get a blank white window.
The terminal output is;
Code:[INFO ] [Logger ] Record log in /home/keir/.kivy/logs/kivy_21-06-18_2.txt
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "/usr/lib/python3/dist-packages/kivy/__init__.py"
[INFO ] [Python ] v3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0]
[INFO ] [Python ] Interpreter at "/usr/bin/python3"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] Backend used <sdl2>
[INFO ] [GL ] OpenGL version <b'4.3 (Compatibility Profile) Mesa 20.0.8'>
[INFO ] [GL ] OpenGL vendor <b'nouveau'>
[INFO ] [GL ] OpenGL renderer <b'NV106'>
[INFO ] [GL ] OpenGL parsed version: 4, 3
[INFO ] [GL ] Shading version <b'4.30'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [CameraGi ] Using Gstreamer 1.14.5.0
[INFO ] [Camera ] Provider: gi(['camera_picamera'] ignored)
[INFO ] [Text ] Provider: pil(['text_sdl2'] ignored)
[INFO ] [Base ] Start application main loop
[INFO ] [GL ] NPOT texture support is available
If I compile the code using buildozer and load only my phone I also get a blank window.
There are youtube videos (using a Windows API) they run this code and it just works.
Perhaps it is something to do with texture? If that seems likely to someone, what code would I add to change the texture.
Can anyone offer a suggestion of what I could try
Common code to use python kivy to act as a QR code reader is;
Code:from kivy.app import App
from kivy.lang import Builder
import kivy_garden.zbarcam
DEMO_APP_KV_LANG = """
BoxLayout:
orientation: 'vertical'
ZBarCam:
id: zbarcam
code_types: 'qrcode', 'ean13'
Label:
size_hint: None, None
size: self.texture_size[0], 50
text: 'test: ' + ', '.join([str(symbol.data) for symbol in zbarcam.symbols])
"""
class DemoApp(App):
def build(self):
return Builder.load_string(DEMO_APP_KV_LANG)
if __name__ == '__main__':
DemoApp().run()If I run this using python3 I get a blank white window.
The terminal output is;
Code:[INFO ] [Logger ] Record log in /home/keir/.kivy/logs/kivy_21-06-18_2.txt
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "/usr/lib/python3/dist-packages/kivy/__init__.py"
[INFO ] [Python ] v3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0]
[INFO ] [Python ] Interpreter at "/usr/bin/python3"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] Backend used <sdl2>
[INFO ] [GL ] OpenGL version <b'4.3 (Compatibility Profile) Mesa 20.0.8'>
[INFO ] [GL ] OpenGL vendor <b'nouveau'>
[INFO ] [GL ] OpenGL renderer <b'NV106'>
[INFO ] [GL ] OpenGL parsed version: 4, 3
[INFO ] [GL ] Shading version <b'4.30'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [CameraGi ] Using Gstreamer 1.14.5.0
[INFO ] [Camera ] Provider: gi(['camera_picamera'] ignored)
[INFO ] [Text ] Provider: pil(['text_sdl2'] ignored)
[INFO ] [Base ] Start application main loop
[INFO ] [GL ] NPOT texture support is available
If I compile the code using buildozer and load only my phone I also get a blank window.
There are youtube videos (using a Windows API) they run this code and it just works.
Perhaps it is something to do with texture? If that seems likely to someone, what code would I add to change the texture.
Can anyone offer a suggestion of what I could try