樹莓派4安裝PTQT5

 https://www.codenong.com/cs106161699/python

 

sudo apt-get install python3-pyqt5

  

 

sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools

  

 

安裝app

sudo apt-get install qtcreator
  

 

  

 

 保存界面文件ui

 

轉化成py可用的文件code

 

python -m PyQt5.uic.pyuic ./qtui1.ui -o ./UI_1test.py

  

 

 

 調用blog

import sys
from PyQt5.QtWidgets import QApplication, QWidget,QMainWindow
from PyQt5.QtGui import QIcon
 
import pyqtgraph as pg
import numpy as np
 
 
#導入類
from UI_1test import *
 
#一個是這個類自己的,一個是這個類繼承
class Example(QMainWindow,Ui_MainWindow):
 
    def __init__(self):
       
        #QMainWindow.__init__(self)
        #Ui_MainWindow.__init__(self)
 
        super(Example, self).__init__()    
        self.setupUi(self)
 
       
       
      
  
 
         
 
 
 
 
 
if __name__ == '__main__':
 
    app = QApplication(sys.argv)
       
    ui=Example()
    ui.show()
 
     
    sys.exit(app.exec_())

  

 

 

 

後期若是用 圖開發繼承

pip install pyqtgraph
相關文章
相關標籤/搜索