def matplotlib(i):
graph_data = open('sampleData.txt', 'r').read()
lines = graph_data.split('\n')
xs = []
ys = []
for line in lines:
if len(line) >1:
x, y = line.split(',')
xs.append(x)
ys.append(y)
fig.clear()
'Limits'
ax = plt.gca()
ax.set_xlim([80, -80])
ax.set_ylim([42, -42])
plt.axis('equal')
'Labels'
plt.xticks([-16, -32, -48, -64, -80, 0, 16, 32, 48, 64, 80])
plt.yticks([-42, -28, -14, 0, 14, 28, 42])
plt.show()
plt.scatter(xs, ys)
'Toolbar Buttons'
insertButt = Button(toolbar, text="Matplotlib TST", fg='Dark Red', bg="Dim Grey", activebackground='Dim Grey',
activeforeground='Dark Red', command=matplotlib).pack(side=LEFT, padx=2, pady=2)
ani = animation.FuncAnimation(fig, matplotlib, interval=1000)
ボタンを使用して関数を実行しようとすると問題が発生します。それは、ボタンを使用せずに正常に動作します。私は、matplotlib()が欠落しました1必要な位置引数 'i'
matplotlibの()不足している1要求される位置引数エラーが出ます:「私は」
は私が単に削除することによってこの問題を解決しようとした、私は、その後、私はエラーを得た、matplotlibの() 0位置引数を取りますが、1は私も私のボタンでコマンド= matplotlibの(I)の後に(i)を入れてみました
を与えられた、(
matplotlibの、私のグラフは空白になって、その後、私はこのエラーを得た)かかり位置付けの引数は0個だが、1個は
私はライブグラフを作成する方法を見つけるために、私は何を意味するのかを知りたいのですが、なぜTkinterのボタンを使って実行するのか分かりません。
あなたの最後の声明、または少なくとも誤解を招く言葉。ボタンと関数を関連付けるときは、かっこを含めないでください。 –
あなたはちょうど私の答えを修正しましたありがとう – Dilmer