PyQtGraph在pyqt中的應用及安裝過程

2022-09-26 01:00:09 字數 1137 閱讀 7987

1.pyqtgraph簡介:

pyqtgraph的主要用途:

1、為資料、繪圖、**等提供快速、可互動圖形顯示。

2、提供快速開發應用的工具。

2.pyqtgraph的安裝:

pip install pyqtgraph

安裝完成之後執行如下**可以看到官方示例。

import pyqtgraph.examplespyqtgraph.examples.run()

官方示例如圖:

3.設定提公升的視窗控制項

將qwidget視窗控制項拖動到主視窗中,然後對提公升的視窗進行設定,如下圖所示

把qwidget控制項重新命名為pyqtgraph

然後上**。。。 

def init_plot(self):

self.p1 = self.pyqtgraphl1.addplot(title="溫度"www.cppcns.com)

self.curve1 = self.p1.plot(pen='rwww.cppcns.com')

self.p1_list = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

def update_plot(self):

# rand = random.randrange(0, 100)

del self.p1_list[0]

self.p1_list.append(self.ch0) #新增最新的資料

self.curve1.setdatwww.cppcns.coma(self.p1_list) #設定圖表的縱座標資料

if self.ptr == 0: #規定吧

pass

self.p1.enableautorange(程式設計客棧'xy', false) ## stop auto-scaling after the first data set is plotted

self.ptr += 1

總結本文標題: pyqtgraph在pyqt中的應用及安裝過程

本文位址:

在linux中安裝pyqt

可直接通過命令列安裝pyqt 通過search命令檢視在倉庫中關於qt的安裝源的具體名稱 apt cache search qt通過apt get命令直接安裝 sudo apt get install python qt4通過以下命令檢視qt版本 qmake v有時候會出現以下錯誤 qmake co...

在PyQt中對QTableView新增右鍵選單

上面的軟體,最左側是qlist,中間是qlabelview,準備給中間的 加個右鍵選單,主要 如下 self.view setcontextmenupolicy qt.customcontextmenu 右鍵選單,如果不設為customcontextmenu,無法使用customcontextmen...

在Virtualenv中匯入PyQT4

最近進行乙個小專案,目的是實現在類似谷歌的介面中,在搜尋框中輸入 url,將對應 的截圖即時返回給使用者。在後台實現過程中,採用了用 pyqt4 的 qtwebkit 來模擬瀏覽器對網頁進行渲染,之後截圖。但在部署過程中出現了問題,即在 virtualenv 中執行程式時無法 import pyqt...