Ayomide Awe
Ayomide Awe

Reputation: 41

Place Graph on Kivy as a Widget with Button

I want to put a graph that self updates. So when I press a Kivy button on my GUI script written with Python and it's supposed to take me to a Screen. The Screen has a graph on a part of the Screen and buttons on the rest of the screen. However, I add the graph and it opens in a separate window. How do I do that?

I used the matplotlib library for plotting the graph.

I used plt.show() and it opens a different window.

Upvotes: 3

Views: 560

Answers (1)

Peter Badida
Peter Badida

Reputation: 12189

To prevent matplotlib from stealing the focus of your Window you need to tell it to do so for some strange reason (maybe because of high usage of MPL in IPython notebook?)

import matplotlib
matplotlib.use('Agg')

After those lines the window should stop stealing. The updating on the other hand is something way different and that's why there's garden.graph and garden.matplotlib.

If you intend to just draw some simple plots, just use the Graph. If you really need MPL and/or you want to do something complex, use the MPL backend (garden.matplotlib).

Upvotes: 1

Related Questions