You cannot start the while loop while what Kivy himself does inside, each iteration checks the input, updates the gui, etc. By doing this on your own, you stop the Kivy cycle from an ever-advancing one. This is not just kiwi, but also how other GUI frameworks work, although not all of them run gui elements in the main thread.
Sleep also does the same - every time you sleep, it does just that, and gui freezes until it ends.
The solution is to connect to the Kivy event system and use the internal while loop. The easiest way is to add a new method to your LoginScreen, as shown below.
in __init__ :
self.ser = serial.Serial('COM3', 9600, timeout=0)
and new method:
def update(self, dt): self.ser.read()
... and then
from kivy.clock import Clock from functools import partial Clock.schedule_interval(self.update, 2)
Then the update method will be called every 2 seconds.
source share