お力をお貸しください。
Kivyでアプリを作っているのですが、
Matplotlibをプログラム内に入れると、
PyinstallerでEXE化したときに実行できません。
解決方法をご存知の方いらっしゃいますでしょうか。
よろしくお願いいたします。
プログラムはここのものを
https://myenigma.hatenablog.com/entry/2016/05/10/221433#matplotlib%E3%81%AE%E3%82%B0%E3%83%A9%E3%83%95%E3%82%92kivy%E3%81%AE%E4%B8%80%E9%83%A8%E3%81%A8%E3%81%97%E3%81%A6%E5%88%A9%E7%94%A8%E3%81%99%E3%82%8B
EXE化はここを参考にしています。
https://www.closetoyou.jp/kivy/introduction-to-kivy16/
###############プログラム###############
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.config import Config
import numpy as np
import matplotlib
matplotlib.use('module://kivy.garden.matplotlib.backend_kivy')
import matplotlib.pyplot as pl
import sys, os
class GraphView(BoxLayout):
def init(self, **kwargs):
super(GraphView, self).init(orientation='vertical')
self.add_widget(Label(text="embeded matplotlib sample"))
self.add_widget(self.graph_plot_sample())
def graph_plot_sample(self): self.fig, ax = pl.subplots() x = np.linspace(-np.pi, np.pi) y = np.sin(x) ax.set_xlabel("X label") ax.set_ylabel("Y label") ax.grid(True) ax.plot(x, y) return self.fig.canvas
class GraphApp(App):
def build(self):
height = 300
Config.set('graphics', 'height', height)
Config.set('graphics', 'width', height * 2)
return GraphView()
if name == 'main':
GraphApp().run()
回答1件
あなたの回答
tips
プレビュー