Hi.
I'm adding widgets based on a HTTP Request that may take long depending on user's internet connection, so I'm in need of threading that to avoid GUI freezing.
However, can't seem to make it work. Here is a snippet of the current code:
@mainthread
def add_w(self, parent, widget):
parent.add_widget(widget)
def add_course():
# HTTP Request I mentioned
course = course_manager.get_course(textfield_text) # This may take some time
courses_stack_layout = constructor_screen.ids.added_courses_stack_layout
course_information_widget = CourseInformation(coursename_label=course.name)
self.add_w(courses_stack_layout, course_information_widget)
The result: sometimes really weird stuff happens. Sometimes.
I have also tried with Clock.schedule_once and Clock.schedule_interval with a Queue.
Same problem happened.
Any hints?
Thanks!
- Gabriel