Guest User

Untitled

a guest
Jun 26th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. from kivy.app import App
  2. from kivy.uix.label import Label
  3. from kivy.uix.gridlayout import GridLayout
  4. from kivy.uix.textinput import TextInput
  5. from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
  6. from kivy.uix.widget import Widget
  7. from kivy.lang import Builder
  8.  
  9. class LoginScreen(GridLayout):
  10. def __init__(self, **kwargs):
  11. super(LoginScreen, self).__init__(**kwargs)
  12. self.cols = 2
  13. self.add_widget(Label(text="Username:"))
  14. self.username = TextInput(multiline=False)
  15. self.add_widget(self.username)
  16.  
  17. self.add_widget(Label(text="Password:"))
  18. self.password = TextInput(multiline=False, password=True)
  19. self.add_widget(self.password)
  20.  
  21. self.add_widget(Label(text="Two Factor Auth:"))
  22. self.tfa = TextInput(multiline=False)
  23. self.add_widget(self.tfa)
  24.  
  25. class MainScreen(Screen):
  26. pass
  27.  
  28. class AnotherScreen(Screen):
  29. pass
  30.  
  31. class ScreenManagement(ScreenManager):
  32. pass
  33.  
  34. presentation = Builder.load_file("screen.kv")
  35.  
  36. class SimpleKivy(App):
  37. def build(self):
  38. return presentation
  39.  
  40. if __name__ == "__main__":
  41. SimpleKivy().run()
  42.  
  43. #: import FadeTransition kivy.uix.screenmanager.FadeTransition
  44.  
  45. ScreenManagement:
  46. transition: FadeTransition()
  47. MainScreen:
  48. AnotherScreen:
  49.  
  50. <MainScreen>:
  51. name: "main"
  52. Button:
  53. color: 0,1,0,1
  54. font_size: 25
  55. size_hint: 0.3,0.2
  56. text: "Click"
  57. on_release: app.root.current = "other"
  58. pos_hint: {"right":1, "top":1}
  59.  
  60.  
  61. <AnotherScreen>:
  62. name: "other"
  63.  
  64. GridLayout:
  65. LoginScreen
Add Comment
Please, Sign In to add comment