Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from kivymd.app import MDApp
- from kivy.lang import Builder
- from kivymd.uix.datatables import MDDataTable
- from kivy.metrics import dp
- from kivy.lang import Builder
- from kivymd.uix.screen import MDScreen
- from kivy.uix.screenmanager import ScreenManager
- from kivy.core.window import Window
- from kivymd.theming import ThemeManager
- KV=('''
- <LOGIN_Window>:
- name:'login_window1'
- FloatLayout:
- BoxLayout:
- orientation: 'vertical'
- MDToolbar:
- title: 'log in page'
- elevation: 10
- left_action_items: [['menu', lambda x: nav_drawer.set_state('open')]]
- md_bg_color: 225/255,96/255,1/255,1
- MDLabel:
- MDLabel:
- MDBoxLayout:
- orientation :'vertical'
- pos_hint: {'center_x':.5}
- # size_hint:None, None
- size_hint: 0.8, 0.8
- MDLabel:
- text:'Log In'
- font_size:'50sp'
- size: self.width, self.height
- halign: 'center'
- height: self.texture_size[1] + dp(10)
- size_hint_y:None
- color:0,0,0,1
- MDLabel:
- text:'Email-ID'
- font_size: '15sp'
- size_hint_y: None
- height: self.texture_size[1] + dp(10)
- color:0,0,0,1
- MDTextFieldRound:
- id: login
- hint_text: 'For Eg:- XXYYZZ@gmail.com'
- icon_left: "email"
- input_type:'text'
- icon_left_color:[0,0,0,1]
- hint_text_color:0,0,0,1
- icon_right_color:[0,0,0,1]
- foreground_color:0,0,0,1
- line_color_focus: 255/255,96/255,1/255,1
- normal_color: [255/255,96/255,1/255,1]
- color_active: [255/255,96/255,1/255,1]
- cursor_color: 0,0,0,1
- required: True
- MDLabel:
- text:'Password'
- font_size: '15sp'
- size_hint_y: None
- height: self.texture_size[1] + dp(10)
- color:0,0,0,1
- MDTextFieldRound:
- id: passw
- hint_text: 'Password'
- icon_left: 'key-variant'
- password: True
- icon_right:'eye-off'
- input_type:'text'
- icon_left_color:0,0,0,1
- hint_text_color:0,0,0,1
- icon_right_color:0,0,0,1
- foreground_color:0,0,0,1
- line_color_focus: 255/255,96/255,1/255,1
- normal_color: 255/255,96/255,1/255,1
- color_active: 255/255,96/255,1/255,1
- cursor_color: 0,0,0,1
- MDBoxLayout:
- orientation :'horizontal'
- spacing: '50dp'
- Label: # placeholder to center buttons
- MDFillRoundFlatButton:
- id: logIn
- text: 'Login'
- md_bg_color: 255/255,96/255,1/255,1
- on_release:
- app.change_screen('tolBar_Window1')
- app.add_datatable()
- Label: # placeholder to center buttons
- MDLabel:
- MDLabel:
- MDLabel:
- <TOolBar_Window>
- name:'tolBar_Window1'
- background_color: 1,1,1,1
- FloatLayout:
- BoxLayout:
- orientation: 'vertical'
- MDToolbar:
- title: 'Data Table'
- elevation: 10
- right_action_items:[['information-outline', lambda x: app.change_screen('about_toolbar_window1')],['logout', lambda x: app.change_screen('login_window1')]]
- size_hint_y: None
- md_bg_color: 225/255,96/255,1/255,1
- StackLayout:
- id: data_layout
- <about_page_toolbarr>:
- name:'about_page_toolbarr_window1'
- FloatLayout:
- BoxLayout:
- orientation: 'vertical'
- MDToolbar:
- title: 'About'
- elevation: 10
- left_action_items: [['arrow-left', lambda x: app.change_screen('about_toolbar_window1')]]
- size_hint_y: None
- md_bg_color: 225/255,96/255,1/255,1
- MDLabel:
- text: 'About rite any thing'
- color:0,0,0,1
- <licence_page_toolbar>:
- name:'licence_page_toolbar_window1'
- FloatLayout:
- BoxLayout:
- orientation: 'vertical'
- MDToolbar:
- title: 'About'
- elevation: 10
- left_action_items: [['arrow-left', lambda x: app.change_screen('about_toolbar_window1')]]
- size_hint_y: None
- md_bg_color: 225/255,96/255,1/255,1
- MDLabel:
- text: 'LICENCE write any thing'
- color:0,0,0,1
- <about_toolbar>:
- name:'about_toolbar_window1'
- FloatLayout:
- BoxLayout:
- orientation: 'vertical'
- MDToolbar:
- title: 'About'
- elevation: 10
- left_action_items: [['arrow-left', lambda x: app.change_screen('tolBar_Window1')]]
- size_hint_y: None
- md_bg_color: 225/255,96/255,1/255,1
- Image:
- id: Ko-image
- source: "image.jpg"
- size_hint_y: None
- BoxLayout:
- orientation: 'vertical'
- size_hint_y: None
- spacing:'-5dp'
- MDLabel:
- text: 'image name'
- font_size: '25sp'
- height: self.texture_size[1] + dp(10)
- halign:'center'
- color:0,0,0,1
- MDLabel:
- text: '00.00.08V'
- font_size: '20sp'
- height: self.texture_size[1] + dp(10)
- halign:'center'
- color:0,0,0,1
- MDLabel:
- text: 'Software By 00.00.01'
- font_size: '12sp'
- height: self.texture_size[1] + dp(10)
- halign:'center'
- color:0,0,0,1
- MDLabel:
- text: 'Application- 00.00.01'
- font_size: '12sp'
- height: self.texture_size[1] + dp(10)
- halign:'center'
- color:0,0,0,1
- OneLineAvatarIconListItem:
- on_release: app.change_screen('about_page_toolbarr_window1')
- text: "About"
- text_color: 255/255,50/255,1/255,1
- theme_text_color: "Custom"
- IconLeftWidget:
- icon: 'information-outline'
- OneLineAvatarIconListItem:
- on_release: app.change_screen('licence_page_toolbar_window1')
- text: "Licence"
- text_color: 255/255,50/255,1/255,1
- theme_text_color: "Custom"
- IconLeftWidget:
- icon: "cog"
- MDLabel:
- MDLabel:
- WindowManager:
- LOGIN_Window:
- TOolBar_Window:
- id:data_scr
- about_page_toolbarr:
- licence_page_toolbar:
- about_toolbar:
- ''')
- class LOGIN_Window(MDScreen):
- pass
- class TOolBar_Window(MDScreen):
- pass
- class about_page_toolbarr(MDScreen):
- pass
- class licence_page_toolbar(MDScreen):
- pass
- class about_toolbar(MDScreen):
- pass
- class WindowManager(ScreenManager):
- pass
- class MainApp(MDApp):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- self.data_tables = None
- def build(self):
- self.theme_cls.primary_palette = "Orange"
- self.theme_cls.primary_hue = "A700"
- Window.bind(on_keyboard=self.key_input)
- return Builder.load_string(KV)
- def key_input(self, window, key, scancode, codepoint, modifier):
- if key == 27:
- return True # override the default behaviour
- else: # the key now does nothing
- return False
- def add_datatable(self):
- self.data_tables = MDDataTable(
- #background_color_header=rgba(0,0,0,1),
- use_pagination=True,
- #how many rows to display on screen
- rows_num = 5,
- column_data=[
- ("[color=#FF4500]No.[/color]", dp(10)),
- ("[color=#FF4500]Pulse Rate[/color]", dp(20)),
- ("[color=#FF4500]SPO2[/color]", dp(15)),
- ("[color=#FF4500]Temprature[/color]", dp(20)),
- ("[color=#FF4500]Capture at[/color]", dp(20)),
- ],
- row_data=[
- (f"{i + 1}",
- "[color=#010203]C[/color]",
- "[color=#010203]C++[/color]",
- "[color=#010203]JAVA[/color]",
- "[color=#010203]Python[/color]",
- )
- for i in range(100)],
- )
- self.root.ids.data_scr.ids.data_layout.add_widget(self.data_tables)
- def change_screen(self, screen):
- self.root.current = screen
- if __name__ == '__main__':
- MainApp().run()
Add Comment
Please, Sign In to add comment