在同一图中或同时显示绘图和输入对话[Python Matplotlib Pyplot PyQt4]

时间:2014-03-06 21:31:38

标签: python matplotlib plot pyqt4

我有兴趣使用pyplot和matplotlib与qt4后端在同一图中有一个情节和一个输入对话框。 我试图在matplotlib小部件库中搜索,但我找不到合适的东西。 理想的结果是在同一图中有绘图和输入对话,或者可以同时使用两者。 有人有建议吗?

这里有一个简化的例子,说明我想做什么,情节和输入对话是否有效,但是一个接一个地出现。

import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt

from PyQt4 import QtGui

x = [0, 1, 2, 3]
y = [0, 1, 2, 3]

plt.plot(x, y)
plt.show()

text,ok = QtGui.QInputDialog.getText(None, 'Input Dialog', 'Enter a number:')
n=float(text)
print n #here I just print, but n will be passed to another function for successive steps.

谢谢!

0 个答案:

没有答案