jayyu3333

keypad pastebin

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