• 大小: 488KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: Python
  • 标签:

资源简介

使用pyqt5实现的Python-GUI动态作图例子,包含PyQtGraph GraphWidget demo和Matplotlib MatplotlibWidget demo

资源截图

代码片段和文件信息

from PyQt4 import QtGuiQtCore
import sys
import ui_main
import numpy as np
import pylab
import time

class ExampleApp(QtGui.QMainWindow ui_main.Ui_MainWindow):
    def __init__(self parent=None):
        super(ExampleApp self).__init__(parent)
        self.setupUi(self)
        self.btnAdd.clicked.connect(self.update)
        self.matplotlibwidget.axes.hold(False) #clear on plot()

    def update(self):
        t1=time.time()
        points=100 #number of data points
        X=np.arange(points)
        Y=np.sin(np.arange(points)/points*3*np.pi+time.time())
        C=pylab.cm.jet(time.time()%10/10) # random color
        self.matplotlibwidget.axes.plot(XYms=100color=Clw=10alpha=.8)
        self.matplotlibwidget.axes.grid()
        self.matplotlibwidget.axes.get_figure().tight_layout() # fill space
        self.matplotlibwidget.draw() # required to update the window
        print(“update took %.02f ms“%((time.time()-t1)*1000))
        if self.chkMore.isChecked():
            QtCore.QTimer.singleShot(10 self.update) # QUICKLY repeat

if __name__==“__main__“:
    app = QtGui.QApplication(sys.argv)
    form = ExampleApp()
    form.show()
    form.update() #start with something
    app.exec_()
    print(“DONE“)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-10-02 20:34  Python-GUI-examples-master\
     文件        1045  2017-01-05 11:23  Python-GUI-examples-master\.gitignore.txt
     目录           0  2017-10-02 20:34  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\
     文件        1094  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\LICENSE.md
     文件         752  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\README.md
     文件      141266  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\demo.gif
     文件          19  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\go.bat
     文件        1268  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\go.py
     文件         254  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\ui_convert.py
     文件        2708  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\ui_main.py
     文件        1746  2017-01-05 11:23  Python-GUI-examples-master\2016-07-30_qt_matplotlib_sine_scroll\ui_main.ui
     目录           0  2017-10-02 20:34  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\
     文件        1094  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\LICENSE.md
     文件         749  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\README.md
     文件      123007  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\demo2.gif
     文件          19  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\go.bat
     文件        1184  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\go.py
     文件         254  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\ui_convert.py
     文件        2649  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\ui_main.py
     文件        1723  2017-01-05 11:23  Python-GUI-examples-master\2016-07-31_qt_PyQtGraph_sine_scroll\ui_main.ui
     目录           0  2017-10-02 20:34  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\
     文件        1100  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\LICENSE.rc
     文件         583  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\README.md
     文件        5805  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\SWHear.py
     文件      221752  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\demo.gif
     文件        1719  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\go.py
     文件         254  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\ui_convert.py
     文件        3054  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\ui_main.py
     文件        2130  2017-01-05 11:23  Python-GUI-examples-master\2016-07-37_qt_audio_monitor\ui_main.ui
     文件        1081  2017-01-05 11:23  Python-GUI-examples-master\LICENSE
     文件         903  2017-01-05 11:23  Python-GUI-examples-master\README.md
............此处省略0个文件信息

评论

共有 条评论

相关资源