Guest User

Untitled

a guest
Apr 11th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. from kivy.app import App
  2. from kivy.uix.gridlayout import GridLayout
  3. from kivy.uix.label import Label
  4. from kivy.uix.textinput import TextInput
  5.  
  6. class LoginScreen(GridLayout):
  7.  
  8. def __init__(self, **kwargs):
  9. super(LoginScreen, self).__init__(**kwargs)
  10. self.cols = 2
  11. self.add_widget(Label(text='User Name'))
  12. username = TextInput(multiline=False)
  13. self.add_widget(self.username)
  14. self.add_widget(Label(text='password'))
  15. password = TextInput(password=True, multiline=False)
  16. self.add_widget(self.password)
  17.  
  18. class MyApp(App):
  19. def build(self):
  20. return LoginScreen()
  21.  
  22. if __name__ == '__main__':
  23. LoginScreen().run()
  24.  
  25. O error que aparece foi:
  26.  
  27. File "D:/Users/Usuario/PycharmProjects/eXcript/main.py", line 40, in <module>
  28. LoginScreen().run()
  29. File "D:/Users/Usuario/PycharmProjects/eXcript/main.py", line 30, in __init__
  30. self.add_widget(self.username)
  31.  
  32. AttributeError: 'LoginScreen' object has no attribute 'username'
Add Comment
Please, Sign In to add comment