Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to add plots to layouts afert clicking the button in KivyMD?

33 views
Skip to first unread message

BS

unread,
May 6, 2020, 4:07:17 PM5/6/20
to Kivy users support
I have problem with adding plots to the layouts. I don't have any idea how to connect the button with my BoxLayouts. I gave every BoxLayout special id but I don't know what to do now. I just want to show some plots after clicking the button. Here is my code:
Tutaj wprowadź kod...import kivy
from kivy.lang import Builder

from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivymd.app import MDApp
import matplotlib.pyplot as plt

KV = '''
GridLayout:
    cols:2

    BoxLayout:
        orientation: "vertical"
        id: plot1
        MDLabel:
            text:"I want to put a plot here"
            halign: "center"

    BoxLayout:
        orientation: "vertical"
        id: plot2
        MDLabel:
            text:"I want to put a plot here"
            halign: "center"

    BoxLayout:
        orientation: "vertical"
        id: plot3
        MDLabel:
            text:"I want to put a plot here"
            halign: "center"


    FloatLayout:
        MDFloatingActionButton:
            pos_hint: {'center_x': .9, 'center_y': .15}
            icon:"chart-bell-curve-cumulative"
            on_release: app.show_plot()
'''

class Main(MDApp):

    def build(self):
        return Builder.load_string(KV)

    def show_plot(self):
        #some plots to show
        pass

Main().run()

This is what I want to get after clicking that yellow button:

plots.PNG



Reply all
Reply to author
Forward
0 new messages