using kivymd to make app for scanning barcode quickly as possible , i created this app with one text field that will take QR code and store it, if user input once , focus will gone and must focus it manually to get another input from user . it is possible to make it take many input without losing his focus?
main.py
from kivymd.app import MDApp
from kivymd.uix.screen import Screen
class Layout(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def check(self):
item = self.ids.qrcode
print(item.text)
class Core(MDApp):
def build(self):
self.theme_cls.primary_palette = "Green"
return Layout()
if __name__ == '__main__':
Core().run()
core.kv
<Layout>:
cols:1
MDTextField:
id: qrcode
hint_text: "QR Code"
focus: True
helper_text: "Enter Shipment QR"
helper_text_mode: "on_focus"
icon_right: "qrcode-scan"
icon_right_color: app.theme_cls.primary_color
pos_hint:{'center_x': 0.5, 'center_y': 0.9}
size_hint_x:None
width:300
on_text_validate: root.check()