I want to run my code on raspberry pi which has a touchscreen attached to it. The GUI is made using Tkinter and I want to pop up the system onscreen keyboard when the entry is focused. Here is my current code:
For binding the entry widget with FocusIn event:
self.usernameEntry.bind('<FocusIn>', self.FocusLogin)
For calling the onscreen keyboard installed in the pi:
def FocusLogin(self,event):
os.system('florence')
My problem is that whatever I enter through florence keyboard it never automatically populates the entry widget. It is only after I close the keyboard that I actually see what I typed in. I've tried matchbox-keyboard but it just freezes the whole UI. Florence seems better but it does not update the entry field as I mentioned. I want the UI to automatically show the keys I'm pressing in the entry field.
For someone looking for the answer, I found 2 ways of solving this:
First, use subprocess.popen to create seperate threads of UI and the Keyboard. This works fine on onboard keyboard but florence lags
Second method is to run florence in background before opening the app. Then use
florence hide
florence show
to hide or display florence on the events you want to bind.