PyQt5--QPixmap


 1 # -*- coding:utf-8 -*-
 2 '''
 3 Created on Sep 20, 2018
 4 
 5 @author: SaShuangYiBing
 6 
 7 Comment: 
 8 '''
 9 import sys
10 from PyQt5.QtGui import QPixmap
11 from PyQt5.QtWidgets import QApplication,QWidget,QHBoxLayout,QLabel
12 
13 class New_test(QWidget):
14     def __init__(self):
15         super().__init__()
16         self.initUI()
17         
18     def initUI(self):
19         hbx = QHBoxLayout(self)
20         lbl = QLabel(self)
21         lbl.setPixmap(QPixmap('python.jpg'))
22         hbx.addWidget(lbl)
23         self.setLayout(hbx)
24         
25         self.move(300,200)
26         self.setWindowTitle('picture')
27         self.show()
28         
29 if __name__ == '__main__':
30     app = QApplication(sys.argv)
31     ex = New_test()
32     sys.exit(app.exec_())

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM