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_())