hab da ein hoffentlich einfaches Problem.
Ich habe mit Kivy eine Login-Gui erstellt mit 2 textinputs und 2 labels. Jetzt möchte ich das eine Virtuelle Tastatur angezeigt wird, über die ich in die textinputs etwas reinschreiben kann.
Mein Code sieht wie folgt aus:
Code: Alles auswählen
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.vkeyboard import VKeyboard
class LoginScreen(GridLayout):
def __init__(self, **kwargs):
super(LoginScreen, self).__init__(**kwargs)
vk = VKeyboard(layout='azerty')
self.cols = 2
self.add_widget(Label(text='User Name'))
self.username = TextInput(multiline=False)
self.add_widget(self.username)
self.add_widget(Label(text='password'))
self.password = TextInput(password=True, multiline=False)
self.add_widget(self.password)
self.add_widget(vk)
def focused(self):
if self.password.focus == True:
self.vk.on_key_down(self)
elif self.username.focus == True:
self.vk.on_key_down(self)
class MyApp(App):
def build(self):
return LoginScreen()
if __name__ == '__main__':
MyApp().run()
class MyApp(App):
def build(self):
return LoginScreen()
if __name__ == '__main__':
MyApp().run()
hab es über die selbstgeschriebene methode "focused" versucht aber hat leider nicht geklappt.
Hat jemand eine Idee wie man das hinbekommt?
Danke schon mal für euere Hilfe.
Viele Grüße
Duall777