rickyc81

Untitled

Sep 27th, 2020
748
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from kivy.lang import Builder
  2. from kivy.uix.boxlayout import BoxLayout
  3. from kivymd.app import MDApp
  4. from kivymd.uix.dialog import MDDialog
  5. from kivymd.uix.list import OneLineListItem, TwoLineAvatarListItem, ThreeLineAvatarListItem, OneLineIconListItem, TwoLineIconListItem
  6. from kivymd.uix.list import ImageLeftWidget, IconLeftWidget
  7.  
  8.  
  9. class weatherStation(MDApp):
  10.  
  11.     contactDialog = None
  12.     infoDialog = None
  13.  
  14.     def build(self):
  15.         self.title = "WeatherStation"
  16.         self.theme_cls.primary_palette = "Teal"
  17.         self.theme_cls.primary_hue = "400"
  18.  
  19.         return Builder.load_file("weatherstation.kv")
  20.  
  21.     def on_start(self):
  22.         for i in range(20):
  23.             icons = IconLeftWidget(icon="temp_ico.ico")
  24.             mdlist = self.root.ids.container
  25.             line = TwoLineIconListItem(
  26.                     text=f"Single-line item {i}",
  27.                     font_style = "H6",
  28.                     secondary_text= "Secondary text here",
  29.                     )
  30.             line.add_widget(icons)
  31.             mdlist.add_widget(line)
  32.  
  33.     def showInfoDialog(self):
  34.         if not self.infoDialog:
  35.             self.infoDialog = MDDialog(
  36.                 title = "Informazioni APP",
  37.                 text = "Made with KivyMD @2020",
  38.                 auto_dismiss = True
  39.             )
  40.         self.infoDialog.open()
  41.  
  42.     def showcontactDialog(self):
  43.         if not self.contactDialog:
  44.             self.contactDialog = MDDialog(
  45.                 title = "I nostri contatti",
  46.                 text = "riccardo.cosenza81@gmail.com",
  47.                 auto_dismiss = True
  48.             )
  49.         self.contactDialog.open()
  50.  
  51. weatherStation().run()
RAW Paste Data