A simplified version of my problem is:
<ValueInput>:
TextInput:
id: value_input
on_text_validate: root.value_input(value_input.text)
<DefineVariables>:
Button:
on_press: root.clear_text()
I have two different classes ValueInput and DefineVariables. What I want to happen is that when I press the Button from <definevariables>, the text of which the user has written in TextInput from <valueinput> shall be cleared.
In the .py file:
class MainWidget(BoxLayout):
ValueInput = NumericProperty(0)
class ValueInput(MainWidget):
def value_input(self, ValueInput):
ValueInput = ValueInput
self.ids.value_input.text = "" #This clears the TextInput box.
class DefineVariables(MainWidget):
def clear_text(self):
CLEAR HERE
If I go to the .py file I figured out that if i do
self.ids.value_input.text
in the ValueInput class, it does clear the text when pressing enter. BUT, I dont want the
self.ids.value_input.text
function to be in that class. I want to do
self.ids.value_input.text
when I press the button of which I have decleared in the Kivy file.
What happens if I do
def clear_text(self):
self.ids.value_input.text = ""
and call the clear_text function using root.clear_text() in the .kv file is that i get this error:
AttributeError: 'super' object has no attribute '__getattr__'
How could I make this work?
What I have tried:
Using a clear_text function in the DefineVariables but to no success.