Answer the question
In order to leave comments, you need to log in
Problem with Kivy Language?
How to pass a variable that is in a kv file to the rest of the code?
Here is an example:
KV = '''
Screen:
MDRaisedButton:
text: 'button'
pos_hint: {'center_x':.5,'center_y':.4}
on_press: app.func()
MDTextField:
id: text
pos_hint: {'center_x':.5,'center_y':.5}
'''
class Test(MDApp):
def build(self):
return Builder.load_string(KV)
def func():
print(text.text)
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