Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.app import App
- from kivy.uix.label import Label
- from kivy.uix.gridlayout import GridLayout
- from kivy.uix.textinput import TextInput
- from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
- from kivy.uix.widget import Widget
- from kivy.lang import Builder
- class LoginScreen(GridLayout):
- def __init__(self, **kwargs):
- super(LoginScreen, self).__init__(**kwargs)
- self.cols = 2
- self.add_widget(Label(text="Username:"))
- self.username = TextInput(multiline=False)
- self.add_widget(self.username)
- self.add_widget(Label(text="Password:"))
- self.password = TextInput(multiline=False, password=True)
- self.add_widget(self.password)
- self.add_widget(Label(text="Two Factor Auth:"))
- self.tfa = TextInput(multiline=False)
- self.add_widget(self.tfa)
- class MainScreen(Screen):
- pass
- class AnotherScreen(Screen):
- pass
- class ScreenManagement(ScreenManager):
- pass
- presentation = Builder.load_file("screen.kv")
- class SimpleKivy(App):
- def build(self):
- return presentation
- if __name__ == "__main__":
- SimpleKivy().run()
- #: import FadeTransition kivy.uix.screenmanager.FadeTransition
- ScreenManagement:
- transition: FadeTransition()
- MainScreen:
- AnotherScreen:
- <MainScreen>:
- name: "main"
- Button:
- color: 0,1,0,1
- font_size: 25
- size_hint: 0.3,0.2
- text: "Click"
- on_release: app.root.current = "other"
- pos_hint: {"right":1, "top":1}
- <AnotherScreen>:
- name: "other"
- GridLayout:
- LoginScreen
Add Comment
Please, Sign In to add comment