So i was just wondering if there was any way to trigger the on_enter event of a TextInput in Kivy when exiting the Textinput with a mouse click somewhere else on the screen. If you need my code for it just text me but I think it should be clear what i mean with that question. Thank you in advance!
EDIT: Little code snippet:
I find it hard to get the correct TextInput and get the same values from the on_focus() function to the details() function. Thank You!
.py:
def details(self, textinput, exercise, part):
print("textinout: " + str(textinput))
print("exercise: " + exercise)
print("part: " + part)
def update(self):
create_plan_class = MDApp.get_running_app().sm.get_screen("createplan")
set_details_class = MDApp.get_running_app().sm.get_screen("setdetails")
self.plan_name = MDApp.get_running_app().sm.get_screen("createplan").ids.trainingplan_name.text
current_self_made_plan_class = MDApp.get_running_app().sm.get_screen("currentselfmadeplans")
lbl = Label(
text=self.plan_name,
color="black",
size_hint=(1, 1),
pos_hint={"center_x": .5, "y": 0}
)
self.flt_name.add_widget(lbl)
plan_details[self.plan_name] = {}
for file in create_plan_class.exercises_in_plan:
name_cleared = file.replace(main.all_exercises_path + "/", "")
name_cleared = name_cleared.replace(".png", "")
img = Image(
source=file,
size_hint=(.7, .7),
pos_hint={"y": .2, "center_x": .5},
allow_stretch=True
)
self.inpt_series = TextInput(
hint_text="series",
multiline=False,
on_text_validate=lambda x, name=name_cleared: self.details(x, name, "series"),
size_hint=(.15, .15),
pos_hint={"y": 0, "center_x": .35}
)
self.inpt_reps = TextInput(
hint_text="reps",
multiline=False,
on_text_validate=lambda x: self.details(x, name_cleared, "reps"),
size_hint=(.15, .15),
pos_hint={"y": 0, "center_x": .5}
)
self.inpt_sp = TextInput(
hint_text="sp",
multiline=False,
on_text_validate=lambda x: self.details(x, name_cleared, "sp"),
size_hint=(.15, .15),
pos_hint={"y": 0, "center_x": .65}
)