jayyu3333

Untitled

Dec 23rd, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. from kivy.config import Config
  2. Config.set('kivy', 'keyboard_mode', 'multi')
  3. from kivymd.app import MDApp
  4. from kivy.lang import Builder
  5. from kivymd.uix.screen import MDScreen
  6. from kivy.uix.screenmanager import ScreenManager
  7. from kivymd.uix.textfield import MDTextFieldRound
  8. from kivy.properties import NumericProperty
  9. from kivy.core.window import Window
  10.  
  11.  
  12. #import json
  13.  
  14.  
  15.  
  16. KV=('''
  17.  
  18.  
  19. <REGITRATION_Window>:
  20. name:'regitration_window1'
  21. #RelativeLayout:
  22.  
  23. MDToolbar:
  24. title: 'About'
  25. elevation: 10
  26. left_action_items: [['arrow-left', lambda x: app.change_screen('login_window1')]]
  27. pos_hint: {"left":1, "top":1}
  28.  
  29.  
  30. MDLabel:
  31. text: 'Full Name'
  32. font_size: 15
  33. pos_hint : {'x':0.0322, 'y':0.35}
  34.  
  35. mainkeypad:
  36. max_characters: 70
  37. hint_text: 'For Eg:- xxx yyy zzz'
  38. pos_hint : {'x':0.0322, 'y':0.790}
  39. size_hint : 0.6, .045
  40.  
  41.  
  42. MDLabel:
  43. text: 'Country Code '
  44. font_size: 15
  45. pos_hint : {'x':0.0322, 'y':0.272}
  46.  
  47. NumericInput:
  48. max_characters: 3
  49. int_text: 'For Eg:- +91'
  50. pos_hint : {'x':0.0322, 'y':0.710}
  51. size_hint : 0.09, .045
  52.  
  53. MDLabel:
  54. text: 'Mobile Number'
  55. font_size: 15
  56. pos_hint : {'x':0.305, 'y':0.272}
  57.  
  58. NumericInput:
  59. max_characters: 10
  60. hint_text: 'For Eg:- 987654321'
  61. pos_hint :{'x':0.305, 'y':0.710}
  62. size_hint : 0.35, .045
  63.  
  64.  
  65. MDLabel:
  66. text: 'Location'
  67. font_size: 15
  68. pos_hint : {'x':0.0322, 'y':0.190}
  69.  
  70. mainkeypad:
  71. max_characters: 70
  72. hint_text: 'For Eg:- kalyan'
  73. pos_hint : {'x':0.0322, 'y':0.630}
  74. size_hint : 0.6, .045
  75.  
  76. MDLabel:
  77. text: 'Pin Code'
  78. font_size: 15
  79. pos_hint : {'x':0.0322, 'y':0.11}
  80.  
  81. mainkeypad:
  82. max_characters: 7
  83. hint_text: 'For Eg:- 400050'
  84. pos_hint : {'x':0.0322, 'y':0.550}
  85. size_hint : 0.6, .045
  86.  
  87. MDLabel:
  88. text: 'City/Town/Village'
  89. font_size: 15
  90. pos_hint : {'x':0.0322, 'y':0.03}
  91.  
  92. mainkeypad:
  93. max_characters: 70
  94. hint_text: 'For Eg:- Mumbai'
  95. pos_hint : {'x':0.0322, 'y':0.470}
  96. size_hint : 0.6, .045
  97.  
  98. MDLabel:
  99. text: 'District/Taluka'
  100. font_size: 15
  101. pos_hint : {'x':0.0322, 'y':-0.05}
  102.  
  103. mainkeypad:
  104. max_characters: 70
  105. hint_text: 'For Eg:- Mumbai'
  106. pos_hint : {'x':0.0322, 'y':0.390}
  107. size_hint : 0.6, .045
  108.  
  109.  
  110.  
  111. MDLabel:
  112. text: 'State'
  113. font_size: 15
  114. pos_hint : {'x':0.0322, 'y':-0.13}
  115.  
  116. mainkeypad:
  117. max_characters: 70
  118. hint_text: 'For Eg:- Maharashtra'
  119. pos_hint : {'x':0.0322, 'y':0.310}
  120. size_hint : 0.6, .045
  121.  
  122.  
  123. MDLabel:
  124. text: 'Country'
  125. font_size: 15
  126. pos_hint : {'x':0.0322, 'y':-0.21}
  127.  
  128. mainkeypad:
  129. max_characters: 70
  130. hint_text: 'For Eg:- India'
  131. pos_hint : {'x':0.0322, 'y':0.230}
  132. size_hint : 0.6, .045
  133.  
  134.  
  135.  
  136. MDLabel:
  137. text: 'Password'
  138. font_size: 15
  139. pos_hint : {'x':0.0322, 'y':-0.29}
  140.  
  141. mainkeypad:
  142. max_characters: 70
  143.  
  144. hint_text: 'For Eg:- sdsddssd'
  145. pos_hint : {'x':0.0322, 'y':0.150}
  146. size_hint : 0.6, .045
  147.  
  148.  
  149.  
  150. MDLabel:
  151. text: 'Confirm Password'
  152. font_size: 15
  153. pos_hint : {'x':0.0322, 'y':-0.37}
  154.  
  155. mainkeypad:
  156. max_characters: 70
  157.  
  158. hint_text: 'For Eg:- SSdssds'
  159. pos_hint : {'x':0.0322, 'y':0.070}
  160. size_hint : 0.6, .045
  161.  
  162.  
  163.  
  164. MDFillRoundFlatButton:
  165. text:'REGISTER'
  166. pos_hint: {'x':.1, 'y':.1}
  167. MDFillRoundFlatButton:
  168. text:'Cancel'
  169. pos_hint: {'x':.3, 'y':.1}
  170.  
  171.  
  172. WindowManager:
  173. REGITRATION_Window:
  174. id: key_num
  175.  
  176. ''')
  177.  
  178.  
  179. class REGITRATION_Window(MDScreen):
  180. pass
  181. #def open_keypad(self):
  182. #self.root.ids.key_num.ids.data_layout.add_widget(self.setup_keyboard)
  183.  
  184. class WindowManager(ScreenManager):
  185. pass
  186.  
  187.  
  188. class NumericInput(MDTextFieldRound):
  189. max_characters = NumericProperty()
  190.  
  191. def __init__(self, **kwargs):
  192. super().__init__(input_filter=self.char_limit, **kwargs)
  193.  
  194. def on_focus(self, instance_text_field, focus_value: bool):
  195. # on focus request a numeric keyboard
  196. if focus_value:
  197. num_kb = Window.request_keyboard(self.close_key, self)
  198. if num_kb.widget:
  199. num_kb.widget.layout = 'numeric.json'
  200.  
  201. def close_key(self):
  202. pass
  203.  
  204. def char_limit(self, substring, from_undo):
  205. if len(self.text) < self.max_characters:
  206. return substring
  207.  
  208. class mainkeypad(MDTextFieldRound):
  209.  
  210. def __init__(self, **kwargs):
  211. super().__init__(input_filter=self.char_limit, **kwargs)
  212.  
  213. Window.request_keyboard(self._keyboard_closed, self.text)
  214.  
  215.  
  216. def _keyboard_closed(self):
  217. pass
  218.  
  219.  
  220. def char_limit(self, substring, from_undo):
  221. if len(self.text) < self.max_characters:
  222. return substring
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229. class MainApp(MDApp):
  230. def build(self):
  231. return Builder.load_string(KV)
  232.  
  233.  
  234. if __name__ == '__main__':
  235. MainApp().run()
Advertisement
Add Comment
Please, Sign In to add comment