zoukankan      html  css  js  c++  java
  • pyinstall pyqt image

    首先新建一个 .qrcimages.qrc 文件,内容格式如下:

    <RCC>
        <qresource prefix="/" >
            <file>fire.png</file>
        </qresource>
    </RCC>
    

    in the Terminal:

    pyrcc4 -o images_qr.py images.qrc
    

    inner_image.py

    #!/usr/bin/env python
    # _*_ coding: utf-8 _*_
    # @Time     : 2017/3/30 13:00
    # @Author   : otfsenter
    # @File     : inner_img.py
    
    import sys
    from PyQt4 import QtGui, QtCore
    import images_qr
    
    class Example(QtGui.QWidget):
    
        def __init__(self):
            super(Example, self).__init__()
    
            self.initUI()
    
        def initUI(self):
    
            hbox = QtGui.QHBoxLayout(self)
            # 创建图片控件,使用图片的文件名作为参数
            # The colon is important, it must be there
            pixmap = QtGui.QPixmap(':/fire.png')
    
            # 将图片控件放入标签控件中
            lbl = QtGui.QLabel(self)
            lbl.setPixmap(pixmap)
    
            hbox.addWidget(lbl)
            self.setLayout(hbox)
    
            self.move(300, 200)
            self.setWindowTitle('Pixmap')
            self.show()
    
    def main():
    
        app = QtGui.QApplication(sys.argv)
        ex = Example()
        sys.exit(app.exec_())
    
    
    if __name__ == '__main__':
        main()
    
  • 相关阅读:
    select top 变量问题
    distinct top執行順序
    Subquery typo with using in(转)
    sql:查询课程号'0312091006'成绩排名第5到第10之间的学生学号
    case when then
    触发器
    索引
    管理事物处理
    053345
    053344
  • 原文地址:https://www.cnblogs.com/otfsenter/p/6384703.html
Copyright © 2011-2022 走看看