Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i try on the dock free mode and Virtual. setup_mode
- but know how to use them and call them in the code
- and is similar with to set validation my password and confirm password as Special character ,number, small and big alphabets
- from kivy.config import Config
- Config.set('kivy', 'keyboard_mode', 'multi')
- from kivymd.app import MDApp
- from kivy.lang import Builder
- from kivymd.uix.screen import MDScreen
- from kivy.uix.screenmanager import ScreenManager
- from kivymd.uix.textfield import MDTextFieldRound
- from kivy.properties import NumericProperty
- from kivy.core.window import Window
- #import json
- KV=('''
- <REGITRATION_Window>:
- name:'regitration_window1'
- #RelativeLayout:
- MDToolbar:
- title: 'About'
- elevation: 10
- left_action_items: [['arrow-left', lambda x: app.change_screen('login_window1')]]
- pos_hint: {"left":1, "top":1}
- MDLabel:
- text: 'Full Name'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.35}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- xxx yyy zzz'
- pos_hint : {'x':0.0322, 'y':0.790}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Country Code '
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.272}
- NumericInput:
- max_characters: 3
- int_text: 'For Eg:- +91'
- pos_hint : {'x':0.0322, 'y':0.710}
- size_hint : 0.09, .045
- MDLabel:
- text: 'Mobile Number'
- font_size: 15
- pos_hint : {'x':0.305, 'y':0.272}
- NumericInput:
- max_characters: 10
- hint_text: 'For Eg:- 987654321'
- pos_hint :{'x':0.305, 'y':0.710}
- size_hint : 0.35, .045
- MDLabel:
- text: 'Location'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.190}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- kalyan'
- pos_hint : {'x':0.0322, 'y':0.630}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Pin Code'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.11}
- mainkeypad:
- max_characters: 7
- hint_text: 'For Eg:- 400050'
- pos_hint : {'x':0.0322, 'y':0.550}
- size_hint : 0.6, .045
- MDLabel:
- text: 'City/Town/Village'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.03}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- Mumbai'
- pos_hint : {'x':0.0322, 'y':0.470}
- size_hint : 0.6, .045
- MDLabel:
- text: 'District/Taluka'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.05}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- Mumbai'
- pos_hint : {'x':0.0322, 'y':0.390}
- size_hint : 0.6, .045
- MDLabel:
- text: 'State'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.13}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- Maharashtra'
- pos_hint : {'x':0.0322, 'y':0.310}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Country'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.21}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- India'
- pos_hint : {'x':0.0322, 'y':0.230}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Password'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.29}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- sdsddssd'
- pos_hint : {'x':0.0322, 'y':0.150}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Confirm Password'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.37}
- mainkeypad:
- max_characters: 70
- hint_text: 'For Eg:- SSdssds'
- pos_hint : {'x':0.0322, 'y':0.070}
- size_hint : 0.6, .045
- MDFillRoundFlatButton:
- text:'REGISTER'
- pos_hint: {'x':.1, 'y':.1}
- MDFillRoundFlatButton:
- text:'Cancel'
- pos_hint: {'x':.3, 'y':.1}
- WindowManager:
- REGITRATION_Window:
- id: key_num
- ''')
- class REGITRATION_Window(MDScreen):
- pass
- #def open_keypad(self):
- #self.root.ids.key_num.ids.data_layout.add_widget(self.setup_keyboard)
- class WindowManager(ScreenManager):
- pass
- class NumericInput(MDTextFieldRound):
- max_characters = NumericProperty()
- def __init__(self, **kwargs):
- super().__init__(input_filter=self.char_limit, **kwargs)
- def on_focus(self, instance_text_field, focus_value: bool):
- # on focus request a numeric keyboard
- if focus_value:
- num_kb = Window.request_keyboard(self.close_key, self)
- if num_kb.widget:
- num_kb.widget.layout = 'numeric.json'
- def close_key(self):
- pass
- def char_limit(self, substring, from_undo):
- if len(self.text) < self.max_characters:
- return substring
- class mainkeypad(MDTextFieldRound):
- def __init__(self, **kwargs):
- super().__init__(input_filter=self.char_limit, **kwargs)
- Window.request_keyboard(self._keyboard_closed, self.text)
- def _keyboard_closed(self):
- pass
- def char_limit(self, substring, from_undo):
- if len(self.text) < self.max_characters:
- return substring
- class MainApp(MDApp):
- def build(self):
- return Builder.load_string(KV)
- if __name__ == '__main__':
- MainApp().run()
Add Comment
Please, Sign In to add comment