editing text in kivy elements

23 views
Skip to first unread message

Esra Issam

unread,
Sep 12, 2022, 6:02:09 AM9/12/22
to Kivy users support
I wrote a function called creatList which is supposed to write loading on the label called conneced_spanner and then create a thread.
but the function does not modify the label until the thread is complete although the line of the modifying comes before the thread, I could not figure out why is this happening.
I need help
thanks in advanced
here is the code

Cthreadpture.PNG

Captu1re.PNG

Elliot Garbus

unread,
Sep 12, 2022, 9:28:39 AM9/12/22
to kivy-...@googlegroups.com

Kivy uses an event loop.  When you set the text attribute, the screen will not be updated until after kivy returns to the event loop.  The way your code is written kivy will not return to the event loop until the after the thread is completed.

 

You can split creatList into 2 parts and use Clock.schedule_once()  to allow kivy to return to the event loop, you will see your updated text on screen.

 

def creatList(self):
    ...
    self.ids.connect_spanner.text =
"Loading..."
   
Clock.schedule_once(self.continue_create_list)
   
def continue_create_list(self, _):
   
creat1 = Thread(...
   

 

 

 

From: Esra Issam
Sent: Monday, September 12, 2022 3:02 AM
To: Kivy users support
Subject: [kivy-users] editing text in kivy elements

 

I wrote a function called creatList which is supposed to write loading on the label called conneced_spanner and then create a thread.

but the function does not modify the label until the thread is complete although the line of the modifying comes before the thread, I could not figure out why is this happening.

I need help

thanks in advanced

here is the code

 

 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/d0058353-e0ca-40d4-aca2-df8acd0dac5fn%40googlegroups.com.

 

Cthreadpture.PNG
Captu1re.PNG

Esra Issam

unread,
Sep 13, 2022, 5:32:43 AM9/13/22
to kivy-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages