Advertisement
Guest User

kivystart.py

a guest
Jan 4th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. #file name: kivystart.py
  2.  
  3. import os
  4. os.environ['KIVY_TEXT'] = 'pygame'
  5.  
  6. import kivy
  7. kivy.require('1.9.2')
  8.  
  9. from kivy.app import App
  10. from kivy.uix.gridlayout import GridLayout
  11. from kivy.uix.label import Label
  12. from kivy.uix.textinput import TextInput
  13.  
  14. class LoginScreen(GridLayout):
  15.    
  16.      def __init__(self, **kwargs):
  17.         super(LoginScreen,self).__init__(**kwargs)
  18.         self.cols = 2
  19.         self.add_widget(Label(text="User Name"))
  20.         self.username = TextInput(multiline=False)
  21.         self.add_widget(self.username)
  22.         self.add_widget(Label(text='Password'))
  23.         self.password = TextInput(password=True,multiline=False)
  24.         self.add_widget(self.password)
  25.        
  26.  
  27. #subclassing
  28. class MyApp(App):
  29.    
  30.     #implementing the build function
  31.     def build(self):
  32.         return LoginScreen()
  33.        
  34.         #instantiating and running it
  35. if __name__ == '__main__':
  36.     MyApp(). run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement