Answer the question
In order to leave comments, you need to log in
How to pass text from MDTextFieldRect to a function?
Tell me, please, I have already rummaged through everything that is possible
. How can I transfer its contents from MDTextFieldRect (located in the main.kv file) after pressing the "Enter" key to the input function in the main.py file?
main.py file
from kivymd.app import MDApp
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.textfield import MDTextFieldRect
class Container(BoxLayout):
pass
class MainApp(MDApp):
def input(self, value):
Snackbar(text=value).open()
def build(self):
all = Container()
return all
MainApp().run()
#:import MDField kivymd.uix.textfield
<Container>:
orientation: "vertical"
MDTextFieldRect:
multiline: False
text: 'text'
on_text_validate: app.input()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question