Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Esempio Kivy: label + testo:
- # Layout grid: divide lo schermo
- # nei 4 widget esposti
- # import kivy:
- import kivy
- # import App:
- from kivy.app import App
- # import Layout Grid:
- from kivy.uix.gridlayout import GridLayout
- # import widgets:
- from kivy.uix.label import Label
- from kivy.uix.textinput import TextInput
- # Screen:
- class LoginScreen(GridLayout):
- #
- def __init__(self, **kwargs):
- super(LoginScreen, self).__init__(**kwargs)
- # numero colonne:
- self.cols = 2
- # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- # widgets: label 1:
- self.add_widget \
- (Label(text='User Name'))
- # widgets: testo 1:
- self.username = \
- TextInput (multiline=False)
- #
- self.add_widget(self.username)
- # widgets: label 2:
- self.add_widget \
- (Label(text='password'))
- # widgets: testo 2:
- self.password = TextInput \
- (password=True, multiline=False)
- #
- self.add_widget(self.password)
- #
- # ok: - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- #
- class MyApp(App):
- #
- def build(self):
- return LoginScreen()
- #
- if __name__ == '__main__':
- MyApp().run()
- #
- # End
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement