I'm working on a Kivy app which should generate plots when the user clicks on an item from a menu. When the user clicks the item, it opens a new screen which should generate the plot. My problem is that I can't seem to get Kivy to show the plot. My code executes without errors so I'm not sure where I'm going wrong.
I've looked for questions on this issue and the best I could find is here (Real-time plotting using matplotlib and kivy in Python) but that didn't work for me.
I also have a secondary question about re-defining the on_enter
method of the Screen
class so that it can use the App method for creating the plot. Is this possible?
Python code (function defined as part of the App class)
def grp_enter(self):
grid = GridLayout(rows = 1, cols = 1)
#grid.add_widget(FigureCanvasKivyAgg(plt.gcf())) should have prepared a canvas but one didn't appear
self.track_instance.associations() # generates the plot
KV code
<GroupScreen>:
on_enter: app.grp_enter()
name: 'groups_screen'
Button:
on_release:
app.root.transition = SlideTransition(direction = "right")
app.root.current = 'main'
text: 'back to the home screen'
font_size: 50