Commit 0058b15c296d7fd45c85efdd91ba13be76b94024

Authored by Dante-Ajushi
2 parents db8e47f1 25bbe58f

Merge branch 'master' of https://github.com/Ozunaki/Divect

Showing 1 changed file with 122 additions and 0 deletions
Practica11.py 0 → 100644
  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 +from kivy.uix.widget import Widget
  6 +from kivy.uix.boxlayout import BoxLayout
  7 +from kivy.uix.button import Button
  8 +from kivy.uix.image import Image
  9 +from kivy.uix.popup import Popup
  10 +
  11 +from kivy.lang import Builder
  12 +
  13 +Builder.load_string('''
  14 +<CustomPopup>:
  15 + size_hint: .5, .7
  16 + auto_dismiss: False
  17 + title: "The Angels"
  18 +
  19 + BoxLayout:
  20 + orientation: 'vertical'
  21 + size_hint: 1, 1
  22 + Label:
  23 + pos_hint: {'center_x': 0.5, 'center_y': 0.5}
  24 + text: "Thanks... HOLI !!!"
  25 + Label:
  26 + pos_hint: {'center_x': 0.5, 'center_y': 0.5}
  27 + text: "Practice 11 using kivy for Movil & PC."
  28 + Label:
  29 + text: ""
  30 + Button:
  31 + text: "Exit"
  32 + on_press: root.dismiss()
  33 + pos_hint: {'center_x': 0.5, 'center_y': 0.5}
  34 + size_hint: .5, .5
  35 +
  36 +''')
  37 +
  38 +
  39 +class CustomPopup(Popup):
  40 + pass
  41 +
  42 +
  43 +
  44 +class LoginScreen(GridLayout):
  45 +
  46 + def __init__(self, **kwargs):
  47 + super(LoginScreen, self).__init__(**kwargs)
  48 + self.cols = 2
  49 +
  50 + self.row_force_default=True
  51 + self.row_default_height=30
  52 + self.size_hint=(.5,.5)
  53 + self.pos_hint= {'center_x': 0.5, 'center_y': 0.5}
  54 +
  55 + self.add_widget(Label(text='User', auto_dismiss=True))
  56 +
  57 + self.username = TextInput(multiline=False)
  58 + self.add_widget(self.username)
  59 +
  60 + self.add_widget(Label(text='password', auto_dismiss=True))
  61 + self.password = TextInput(password=True, multiline=False)
  62 +
  63 + self.add_widget(self.password)
  64 +
  65 +
  66 +
  67 +class Footer(GridLayout):
  68 +
  69 + def __init__(self, ** kwargs):
  70 + super(Footer, self).__init__(** kwargs)
  71 + self.cols = 2
  72 + self.row_force_default=True
  73 + self.row_default_height=30
  74 + self.size_hint=(.5,.5)
  75 + self.pos_hint= {'center_x': 0.5, 'center_y': 0.5}
  76 +
  77 + def callback(self):
  78 + p = CustomPopup()
  79 + p.open()
  80 +
  81 + def running(self):
  82 + exit()
  83 +
  84 + btn2 = Button(text='LOGIN')
  85 + btn3 = Button(text='CANCEL')
  86 +
  87 + btn2.bind(on_press=callback)
  88 + btn3.bind(on_press=running)
  89 +
  90 + self.add_widget(btn2)
  91 + self.add_widget(btn3)
  92 + #self.add_widget(MyDialog())
  93 +
  94 +
  95 +
  96 +
  97 +
  98 +class View1(BoxLayout):
  99 + def __init__(self, **kwargs):
  100 + super(View1, self).__init__(**kwargs)
  101 + layout = BoxLayout(orientation='vertical', text_size= self.size, size_hint=(1, 1), auto_dismiss=False)
  102 +
  103 + title = Label(text='MyRestaurant!!', font_size=50, size_hint=(1, .5))
  104 + subtitle = Label(text='Pleace enter your user name\n and password to access',size_hint=(1, .7))
  105 +
  106 + layout.add_widget(title)
  107 + layout.add_widget(subtitle)
  108 + layout.add_widget(LoginScreen())
  109 +
  110 + layout.add_widget(Footer())
  111 +
  112 + self.add_widget(layout)
  113 +
  114 +
  115 +class francisco(App):
  116 +
  117 + def build(self):
  118 + return View1()
  119 +
  120 +
  121 +if __name__ == '__main__':
  122 + francisco().run()
... ...