jayyu3333

Untitled

Jan 27th, 2022 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.19 KB | None | 0 0
  1. import os
  2. from kivymd.app import MDApp
  3. from kivy.lang import Builder
  4. from kivymd.uix.datatables import MDDataTable
  5. from kivy.metrics import dp
  6. from kivy.lang import Builder
  7. from kivymd.uix.screen import MDScreen
  8. from kivy.uix.screenmanager import ScreenManager
  9. from kivy.core.window import Window
  10. from kivymd.theming import ThemeManager
  11.  
  12.  
  13. KV=('''
  14. <LOGIN_Window>:
  15.    name:'login_window1'
  16.    FloatLayout:
  17.        BoxLayout:
  18.            orientation: 'vertical'
  19.            MDToolbar:
  20.                title: 'log in page'
  21.                elevation: 10
  22.                left_action_items: [['menu', lambda x: nav_drawer.set_state('open')]]
  23.                md_bg_color: 225/255,96/255,1/255,1
  24.  
  25.            MDLabel:
  26.            MDLabel:
  27.            
  28.            MDBoxLayout:
  29.                orientation :'vertical'
  30.                pos_hint: {'center_x':.5}
  31.                # size_hint:None, None
  32.                size_hint: 0.8, 0.8
  33.  
  34.                MDLabel:
  35.                    text:'Log In'
  36.                    font_size:'50sp'
  37.                    size: self.width, self.height
  38.                    halign: 'center'
  39.                    height: self.texture_size[1] + dp(10)
  40.                    size_hint_y:None
  41.                    color:0,0,0,1
  42.                          
  43.                MDLabel:
  44.                    text:'Email-ID'
  45.                    font_size: '15sp'
  46.                    size_hint_y: None
  47.                    height: self.texture_size[1] + dp(10)
  48.                    color:0,0,0,1
  49.  
  50.                MDTextFieldRound:
  51.                    id: login
  52.                    hint_text: 'For Eg:- XXYYZZ@gmail.com'
  53.                    icon_left: "email"
  54.                    input_type:'text'
  55.                    icon_left_color:[0,0,0,1]
  56.                    hint_text_color:0,0,0,1
  57.                    icon_right_color:[0,0,0,1]
  58.                    foreground_color:0,0,0,1
  59.                    line_color_focus: 255/255,96/255,1/255,1
  60.                    normal_color: [255/255,96/255,1/255,1]
  61.                    color_active: [255/255,96/255,1/255,1]
  62.                    cursor_color: 0,0,0,1
  63.                    required: True  
  64.                    
  65.  
  66.  
  67.                MDLabel:
  68.                    text:'Password'
  69.                    font_size: '15sp'
  70.                    size_hint_y: None
  71.                    height: self.texture_size[1] + dp(10)
  72.                    color:0,0,0,1
  73.                            
  74.                MDTextFieldRound:
  75.                    id: passw
  76.                    hint_text: 'Password'
  77.                    icon_left: 'key-variant'
  78.                    password: True
  79.                    icon_right:'eye-off'
  80.                    input_type:'text'
  81.                    icon_left_color:0,0,0,1
  82.                    hint_text_color:0,0,0,1
  83.                    icon_right_color:0,0,0,1
  84.                    foreground_color:0,0,0,1
  85.                    line_color_focus: 255/255,96/255,1/255,1
  86.                    normal_color: 255/255,96/255,1/255,1
  87.                    color_active: 255/255,96/255,1/255,1
  88.                    cursor_color: 0,0,0,1
  89.            
  90.            MDBoxLayout:
  91.                orientation :'horizontal'
  92.                spacing: '50dp'
  93.                Label:  # placeholder to center buttons
  94.                MDFillRoundFlatButton:
  95.                    id: logIn
  96.                    text: 'Login'
  97.                    md_bg_color: 255/255,96/255,1/255,1
  98.                    on_release:
  99.                        app.change_screen('tolBar_Window1')
  100.                        app.add_datatable()
  101.  
  102.                
  103.  
  104.                Label:  # placeholder to center buttons
  105.  
  106.            MDLabel:
  107.            MDLabel:
  108.            MDLabel:
  109.  
  110.  
  111.  
  112.    
  113.  
  114.  
  115.  
  116. <TOolBar_Window>
  117.    name:'tolBar_Window1'
  118.    background_color: 1,1,1,1
  119.    FloatLayout:
  120.    
  121.        BoxLayout:
  122.            orientation: 'vertical'
  123.            
  124.            MDToolbar:
  125.                title: 'Data Table'
  126.                elevation: 10
  127.                right_action_items:[['information-outline', lambda x: app.change_screen('about_toolbar_window1')],['logout', lambda x: app.change_screen('login_window1')]]
  128.                size_hint_y: None
  129.                md_bg_color: 225/255,96/255,1/255,1
  130.            
  131.            StackLayout:
  132.                id: data_layout
  133.                    
  134.  
  135. <about_page_toolbarr>:
  136.    name:'about_page_toolbarr_window1'
  137.    FloatLayout:
  138.        BoxLayout:
  139.            orientation: 'vertical'
  140.            MDToolbar:
  141.                title: 'About'
  142.                elevation: 10
  143.                left_action_items: [['arrow-left', lambda x: app.change_screen('about_toolbar_window1')]]
  144.                size_hint_y: None
  145.                md_bg_color: 225/255,96/255,1/255,1
  146.            MDLabel:
  147.                text: 'About rite any thing'
  148.                color:0,0,0,1
  149.                          
  150.                
  151. <licence_page_toolbar>:
  152.    name:'licence_page_toolbar_window1'
  153.    FloatLayout:
  154.        BoxLayout:
  155.            orientation: 'vertical'
  156.            MDToolbar:
  157.                title: 'About'
  158.                elevation: 10
  159.                left_action_items: [['arrow-left', lambda x: app.change_screen('about_toolbar_window1')]]
  160.                size_hint_y: None
  161.                md_bg_color: 225/255,96/255,1/255,1
  162.            MDLabel:
  163.                text: 'LICENCE write any thing'
  164.                color:0,0,0,1
  165.              
  166. <about_toolbar>:
  167.    name:'about_toolbar_window1'
  168.    FloatLayout:
  169.        BoxLayout:
  170.            orientation: 'vertical'
  171.            MDToolbar:
  172.                title: 'About'
  173.                elevation: 10
  174.                left_action_items: [['arrow-left', lambda x: app.change_screen('tolBar_Window1')]]
  175.                size_hint_y: None
  176.                md_bg_color: 225/255,96/255,1/255,1
  177.            Image:
  178.                id: Ko-image
  179.                source: "image.jpg"
  180.                size_hint_y: None
  181.            BoxLayout:
  182.                orientation: 'vertical'
  183.                size_hint_y: None
  184.                spacing:'-5dp'
  185.                MDLabel:
  186.                    text: 'image name'
  187.                    font_size: '25sp'
  188.                    height: self.texture_size[1] + dp(10)
  189.                    halign:'center'
  190.                    color:0,0,0,1
  191.                    
  192.                    
  193.                    
  194.                MDLabel:
  195.                    text: '00.00.08V'
  196.                    font_size: '20sp'
  197.                    height: self.texture_size[1] + dp(10)
  198.                    halign:'center'
  199.                    color:0,0,0,1
  200.            
  201.                MDLabel:
  202.                    text: 'Software By 00.00.01'
  203.                    font_size: '12sp'
  204.                    height: self.texture_size[1] + dp(10)
  205.                    halign:'center'
  206.                    color:0,0,0,1
  207.                MDLabel:
  208.                    text: 'Application- 00.00.01'
  209.                    font_size: '12sp'
  210.                    height: self.texture_size[1] + dp(10)
  211.                    halign:'center'
  212.                    color:0,0,0,1
  213.                    
  214.        
  215.            OneLineAvatarIconListItem:
  216.                on_release: app.change_screen('about_page_toolbarr_window1')
  217.                text: "About"
  218.                text_color:  255/255,50/255,1/255,1
  219.                theme_text_color:  "Custom"
  220.                IconLeftWidget:
  221.                    icon: 'information-outline'
  222.                
  223.                    
  224.            OneLineAvatarIconListItem:
  225.                on_release: app.change_screen('licence_page_toolbar_window1')
  226.                text: "Licence"
  227.                text_color:  255/255,50/255,1/255,1
  228.                theme_text_color:  "Custom"
  229.                IconLeftWidget:
  230.                    icon: "cog"
  231.            MDLabel:
  232.            MDLabel:
  233.            
  234.            
  235.  
  236.                
  237.  
  238.                    
  239.                
  240.                    
  241.  
  242.  
  243.  
  244.            
  245.  
  246.            
  247.            
  248.              
  249.  
  250.  
  251. WindowManager:
  252.    LOGIN_Window:
  253.  
  254.    TOolBar_Window:
  255.        id:data_scr
  256.  
  257.    about_page_toolbarr:
  258.  
  259.    licence_page_toolbar:
  260.  
  261.    about_toolbar:
  262.  
  263.    
  264.            ''')
  265.  
  266.  
  267.  
  268. class LOGIN_Window(MDScreen):
  269.     pass
  270.  
  271.  
  272.  
  273.  
  274. class TOolBar_Window(MDScreen):
  275.     pass
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283. class about_page_toolbarr(MDScreen):
  284.     pass
  285.  
  286. class licence_page_toolbar(MDScreen):
  287.     pass
  288.  
  289. class about_toolbar(MDScreen):
  290.     pass
  291.  
  292.  
  293.  
  294.  
  295. class WindowManager(ScreenManager):
  296.     pass
  297.  
  298. class MainApp(MDApp):
  299.    
  300.     def __init__(self, **kwargs):
  301.         super().__init__(**kwargs)
  302.         self.data_tables = None
  303.    
  304.    
  305.     def build(self):
  306.         self.theme_cls.primary_palette = "Orange"
  307.         self.theme_cls.primary_hue = "A700"
  308.         Window.bind(on_keyboard=self.key_input)
  309.         return Builder.load_string(KV)
  310.  
  311.     def key_input(self, window, key, scancode, codepoint, modifier):
  312.         if key == 27:  
  313.             return True  # override the default behaviour
  314.         else:           # the key now does nothing
  315.             return False
  316.  
  317.     def add_datatable(self):
  318.         self.data_tables = MDDataTable(
  319.             #background_color_header=rgba(0,0,0,1),
  320.             use_pagination=True,
  321.             #how many rows to display on screen
  322.             rows_num = 5,
  323.             column_data=[
  324.                 ("[color=#FF4500]No.[/color]", dp(10)),
  325.                 ("[color=#FF4500]Pulse Rate[/color]", dp(20)),
  326.                 ("[color=#FF4500]SPO2[/color]", dp(15)),
  327.                 ("[color=#FF4500]Temprature[/color]", dp(20)),
  328.                 ("[color=#FF4500]Capture at[/color]", dp(20)),
  329.                
  330.                 ],
  331.             row_data=[
  332.                 (f"{i + 1}",
  333.                  "[color=#010203]C[/color]",
  334.                  "[color=#010203]C++[/color]",
  335.                  "[color=#010203]JAVA[/color]",
  336.                  "[color=#010203]Python[/color]",
  337.                  )
  338.                 for i in range(100)],
  339.                  
  340.         )
  341.  
  342.         self.root.ids.data_scr.ids.data_layout.add_widget(self.data_tables)
  343.    
  344.     def change_screen(self, screen):
  345.         self.root.current = screen
  346.  
  347.  
  348. if __name__ == '__main__':  
  349.     MainApp().run()
  350.  
Add Comment
Please, Sign In to add comment