I have created a login form, on a password section there is a checkbox to check whether the user needs to show or hide their password. When I input a random password and checked, unfortunately, an error showed:
self.root.ids.password.password = False
File "kivy\properties.pyx", line 864, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
def show_password(self, checkbox, value):
if value:
self.root.ids.password.password = False
self.root.ids.password_text.text = 'Hide password'
else:
self.root.ids.password.password = True
self.root.ids.password_text.text = 'Show password'
MDFloatLayout:
size_hint: .79, .08
pos_hint: {"center_x": .5, "center_y": .32}
MDLabel:
text: "Password"
font_size: "14sp"
pos_hint: {"center_x": .5, "center_y": 1.2}
TextInput:
id: password
# hint_text: 'Password'
size_hint_y: .75
pos_hint: {"center_x": .49, "center_y": .6}
background_color: 0,0,0,0
cursor_color: 0,0,0,1
cursor_width: "2sp"
font_size: "17sp"
multiline: False
password: True
Image:
source: "media/key.png"
pos_hint: {"center_x": .96, "center_y": .5}
size_hint: .4, .4
MDFloatLayout:
pos_hint: {"center_x": .5, "center_y": 0}
size_hint_y: .03
md_bg_color: 120/255, 120/255, 120/255, 1
MDCheckbox:
size_hint: None, None
size: '48dp', '48dp'
pos_hint: {'center_x': 0.18,'center_y': 0.25}
on_active: app.show_password(*args)
MDLabel:
id: password_text
text: 'Show Password'
pos_hint: {'center_x': 0.75,'center_y': 0.25}
How to fixed it?