'Kivy passcode login
I'm trying to make a password system with kivy, and tried coding how many tries the users have until the code does somthing but every time i input a text it goes in a loop saying i have -(loads of numbers) tries left
main code:
def on_text_validate(self, widget):
self.text_input_str = widget.text
print(self.text_input_str)
passcode_input = self.text_input_str
passcode_input = ""
passcode = "5up9down"
tries = 3
while passcode_input != passcode:
if passcode_input != passcode:
passcode_input
if passcode_input == passcode:
print("well done!")
return True
else:
tries -= 1
print("you have {tries} tries left! ")
if tries == 0:
print("nope")
kivy file:
WidgetsExample:
<WidgetsExample>:
cols: 5
rows: 5
TextInput:
id: passcode
multiline: False
size_hint: None, 1
width: "100dp"
text: "nice"
on_text_validate: root.on_text_validate(self)
Label:
text: root.text_input_str
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
