title: KivyMD - Python - How to add new widgets on the screen dynamicaly?
body: <p>I'm the very beginner in python and that is my first application and I still haven't learnd much, so please don't judge me for not smart code (I write almost all in one heap, sorry for that). </p>
  
  <p>The main idea of application was in remining the user to do some activities, e.g. drink water, take medicine and see that all in a calendar (you'll see it on screenshots <a href="https://i.stack.imgur.com/M5jTH.png" rel="nofollow noreferrer">here</a> and <a href="https://i.stack.imgur.com/b8KpI.png" rel="nofollow noreferrer">here</a>), but at first I want to make a "Take Medicine" part - it has to calculate how many days the user have to take pills if he/she knows how many pills they have and how many times a day they have to take them.</p>
  
  <p>I've created two screens: Main for displaying the objects and Second to create that widgets. Now I want to fill all the data on the Second screen and add the widget with that data to the Main screen. Maybe I should use MDCards or Lists? But I really have no idea how to do it all. </p>
  
  <p>Should I create database to add data there and then create new widgets on the Main screen according to that and if yes so how? And how to create and represent that widgets dynamicaly? Maybe I have to create function that will somehow add widgets to the 2nd tab on Main screen, but where and how slould I implement it?</p>
  
  <p>Really hope for your help because it's my project for university programming course but my professor doesn't want to help students at all so i have no one else to ask.</p>
  
  <p>So it's <strong>main.py</strong></p>
  
  <pre><code>from kivy.core.window import Window
  from kivy.uix.boxlayout import BoxLayout
  from kivy.uix.screenmanager import Screen, ScreenManager
  from kivymd.app import MDApp
  
  class ScreensManager(ScreenManager):
      pass
  
  class MainScreen(Screen):
      pass
  
  class SecondScreen(Screen):
      pass
  
  
  class MyApp(MDApp):
      def __init__(self, **kwargs):
          self.title = "Do Not Forget"
          self.theme_cls.primary_palette = "Teal"
          Window.size = (1080 / 3.4, 2280 / 3.4)
          super().__init__(**kwargs)
  
      def build(self):
          return ScreensManager() 
  
  if __name__ == "__main__":
      MyApp().run()
  </code></pre>
  
  <p>And <strong>my.kv</strong></p>
  
  <pre><code>&lt;ScreensManager&gt;:
      MainScreen:
      SecondScreen:
  
  &lt;MainScreen&gt;:
      name: "main_screen"
  
      BoxLayout:
          orientation: 'vertical'
  
          MDBottomNavigation:
              MDBottomNavigationItem:
                  name: 'screen1'
                  text: 'active'
                  icon: 'note-plus'
  
                  MDFloatingActionButton:
                      pos_hint:{"center_x": .85, "center_y": .075}
                      icon: 'plus'
                      md_bg_color: app.theme_cls.primary_color
  
                      #this is uncompleted part, doesn't matter for now
                      #on_release:
                      #   app.root.current = "third_screen"
                      #   root.manager.transition.direction = "left"
  
  
              MDBottomNavigationItem:
                  name: 'screen2'
                  text: 'medicine'
                  icon: 'pill'
  
                  MDFloatingActionButton:
                      pos_hint:{"center_x": .85, "center_y": .075}
                      icon: 'plus'
                      md_bg_color: app.theme_cls.primary_color
                      on_release:
                          app.root.current = "second_screen"
                          root.manager.transition.direction = "left"
  
              MDBottomNavigationItem:
                  name: 'screen3'
                  text: 'calendar'
                  icon: 'calendar'
  
  
  &lt;SecondScreen&gt;:
      name: "second_screen"
  
      BoxLayout:
          orientation: 'vertical'
          BoxLayout:
              orientation: 'vertical'
              padding: 20
  
              MDLabel:
                  text: "Insert your data"
  
              Widget:
  
              MDLabel:
                  text:"Name of medicine"
  
              MDTextField:
                  id: name_med
                  hint_text: "Name"
                  mode: "rectangle"
  
              Widget:
  
              MDLabel:
                  text:"How many pills do you have?"
  
              MDTextField:
                  id: pills_amount
                  hint_text: "Pills amount"
                  mode: "rectangle"
  
              Widget:
  
              MDLabel:
                  text:"How many times a day to take them?"
  
              MDTextField:
                  id: times_amount
                  hint_text: "Times a day"
                  mode: "rectangle"
  
          FloatLayout:
              MDFloatingActionButton:
                  pos_hint:{"center_x": .2, "center_y": .2}
                  icon: 'arrow-left'
                  on_release:
                      app.root.current = "main_screen"
                      root.manager.transition.direction = "right"
  
              MDFloatingActionButton:
                  pos_hint:{"center_x": .8, "center_y": .2}
                  icon: 'check'
                  md_bg_color: app.theme_cls.primary_color
                  on_release:
                      app.root.current = "main_screen"
                      root.manager.transition.direction = "right"
  
  </code></pre>