当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QPixmap方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QPixmap方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPixmap方法的具体用法?Python QtGui.QPixmap怎么用?Python QtGui.QPixmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui的用法示例。


在下文中一共展示了QtGui.QPixmap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: about

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def about(self):
        RightToLeft=1;
        msgBox=QtGui.QMessageBox(self.centralwidget);
        msgBox.setWindowTitle(u"عن البرنامج");
##          msgBox.setTextFormat(QrCore.QRichText);

        data=QtCore.QFile("ar/about.html");
        if (data.open(QtCore.QFile.ReadOnly)):
            textstream=QtCore.QTextStream(data);
            textstream.setCodec("UTF-8");
            text_about=textstream.readAll();
        else:
#            text=u"لا يمكن فتح ملف المساعدة"
            text_about=u"""<h1>فكرة</h1>

"""
        msgBox.setText(text_about);
        msgBox.setLayoutDirection(RightToLeft);
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok);
        msgBox.setIconPixmap(QtGui.QPixmap(os.path.join(PWD, "ar/images/logo.png")));
        msgBox.setDefaultButton(QtGui.QMessageBox.Ok);
        msgBox.exec_(); 
开发者ID:linuxscout,项目名称:mishkal,代码行数:24,代码来源:appgui.py

示例2: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def setupUi(self, Window):
        '''被主窗口调用'''
        Window.setWindowTitle(_fromUtf8("便签"))
        Window.setMinimumWidth(400)
        Window.setMaximumWidth(400)

        '''初始化组件'''
        self.layout = QtGui.QVBoxLayout()
        self.topLabelPix = QtGui.QPixmap(setting.topLabelImgPath)
        self.topLabel = QtGui.QLabel()

        '''设置组件属性'''
        self.layout.setMargin(0)
        self.layout.setSpacing(0)
        self.topLabel.setPixmap(self.topLabelPix)

        '''设置布局'''
        self.layout.addWidget(self.topLabel)

        self.setLayout(self.layout) 
开发者ID:cosven,项目名称:memo,代码行数:22,代码来源:window_ui.py

示例3: registerCmap

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def registerCmap(self):
        """ Add matplotlib cmaps to the GradientEditors context menu"""
        self.gradientEditorItem.menu.addSeparator()
        savedLength = self.gradientEditorItem.length
        self.gradientEditorItem.length = 100
        
        
        for name in self.mplColorMaps:
            px = QPixmap(100, 15)
            p = QPainter(px)
            self.gradientEditorItem.restoreState(self.mplColorMaps[name])
            grad = self.gradientEditorItem.getGradient()
            brush = QBrush(grad)
            p.fillRect(QtCore.QRect(0, 0, 100, 15), brush)
            p.end()
            label = QLabel()
            label.setPixmap(px)
            label.setContentsMargins(1, 1, 1, 1)
            act =QWidgetAction(self.gradientEditorItem)
            act.setDefaultWidget(label)
            act.triggered.connect(self.cmapClicked)
            act.name = name
            self.gradientEditorItem.menu.addAction(act)
        self.gradientEditorItem.length = savedLength 
开发者ID:qkitgroup,项目名称:qkit,代码行数:26,代码来源:PlotWindow.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def __init__(self, old_widget, new_widget=None, duration=1000, reverse=False):
    
        QtGui.QWidget.__init__(self, new_widget)
        
        self.resize(old_widget.size())
        
        self.old_pixmap = QtGui.QPixmap(old_widget.size())
        old_widget.render(self.old_pixmap)
        
        self.pixmap_opacity = 1.0
        
        self.timeline = QtCore.QTimeLine()
        if reverse:
            self.timeline.setDirection(self.timeline.Backward)
        self.timeline.valueChanged.connect(self.animate)
        self.timeline.finished.connect(self.deleteLater)
        self.timeline.setDuration(duration)

        self.timeline.start()
        self.show() 
开发者ID:justinfx,项目名称:tutorials,代码行数:22,代码来源:fader.py

示例5: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def __init__(self, parent=None):
        super(FlatCAMInfoBar, self).__init__(parent=parent)

        self.icon = QtGui.QLabel(self)
        self.icon.setGeometry(0, 0, 12, 12)
        self.pmap = QtGui.QPixmap('share/graylight12.png')
        self.icon.setPixmap(self.pmap)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(5, 0, 5, 0)
        self.setLayout(layout)

        layout.addWidget(self.icon)

        self.text = QtGui.QLabel(self)
        self.text.setText("Hello!")
        self.text.setToolTip("Hello!")

        layout.addWidget(self.text)

        layout.addStretch() 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:23,代码来源:FlatCAMGUI.py

示例6: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__
            
        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:26,代码来源:universal_tool_template_0903.py

示例7: showCode

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def showCode(self):
        pixmap = QtGui.QPixmap()
        pixmap.load("api/code.jpg")
        pixmap.scaledToHeight(60)
        pixmap.scaledToWidth(120)
        self.scene_code = QtGui.QGraphicsScene(self)
        item = QtGui.QGraphicsPixmapItem(pixmap)
        self.scene_code.addItem(item)
        self.ui.img_code.setScene(self.scene_code)
        self.resize(257, 235)
        self.ui.lbl_code.setGeometry(QtCore.QRect(20, 110, 63, 18))
        self.ui.text_code.setGeometry(QtCore.QRect(70, 100, 113, 28))
        self.ui.img_code.setGeometry(QtCore.QRect(60, 130, 120, 50))
        self.ui.btn_login.setGeometry(QtCore.QRect(20, 190, 93, 27))
        self.ui.btn_cancel.setGeometry(QtCore.QRect(140, 190, 93, 27))
        self.ui.lbl_code.show()
        self.ui.text_code.show()
        self.ui.img_code.show()

# chat 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:22,代码来源:run.py

示例8: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def setupUi(self, qgpkgDlg):
        qgpkgDlg.setObjectName(_fromUtf8("qgpkgDlg"))
        qgpkgDlg.resize(456, 358)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/QgisGeopackage/about.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        qgpkgDlg.setWindowIcon(icon)
        self.verticalLayout = QtGui.QVBoxLayout(qgpkgDlg)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.textEdit = QtGui.QTextEdit(qgpkgDlg)
        self.textEdit.setReadOnly(True)
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.verticalLayout.addWidget(self.textEdit)
        self.button_box = QtGui.QDialogButtonBox(qgpkgDlg)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Close)
        self.button_box.setObjectName(_fromUtf8("button_box"))
        self.verticalLayout.addWidget(self.button_box)

        self.retranslateUi(qgpkgDlg)
        QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), qgpkgDlg.accept)
        QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("rejected()")), qgpkgDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(qgpkgDlg) 
开发者ID:pka,项目名称:qgpkg,代码行数:24,代码来源:ui_about_dialog.py

示例9: add_image_to_layout

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def add_image_to_layout(layout, image_file_name):
    '''adds an image, as a QLabel, to a layout'''
    label =  qt_widgets.QLabel()
    pixmap =  QtGui.QPixmap(image_file_name)
    label.setPixmap(pixmap)
    layout.addWidget(label) 
开发者ID:aroberge,项目名称:easygui_qt,代码行数:8,代码来源:utils.py

示例10: create_page

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def create_page(self, page):
        new_page = qt_widgets.QWizardPage()
        layout = qt_widgets.QVBoxLayout()
        for kind, value in page:
            if kind.lower() == "title":
                new_page.setTitle(value)
            elif kind.lower() == "text":
                label = qt_widgets.QLabel(value)
                label.setWordWrap(True)
                layout.addWidget(label)
            elif kind.lower() == "image":
                label =  qt_widgets.QLabel()
                pixmap =  QtGui.QPixmap(value)
                label.setPixmap(pixmap)
                layout.addWidget(label)
            elif kind.lower() == "many images":
                h_layout = qt_widgets.QHBoxLayout()
                h_box = qt_widgets.QGroupBox('')
                for image in value:
                    label =  qt_widgets.QLabel()
                    pixmap =  QtGui.QPixmap(image)
                    label.setPixmap(pixmap)
                    h_layout.addWidget(label)
                h_box.setLayout(h_layout)
                layout.addWidget(h_box)
        new_page.setLayout(layout)
        self.addPage(new_page) 
开发者ID:aroberge,项目名称:easygui_qt,代码行数:29,代码来源:wizard_maker.py

示例11: show_image

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def show_image(self, image):
        image = QtGui.QImage(image)

        bg = QtGui.QPixmap.fromImage(image)
        self.setPixmap(bg.scaled(
                self.size(),
                QtCore.Qt.KeepAspectRatio,
                QtCore.Qt.SmoothTransformation)) 
开发者ID:n0bel,项目名称:PiClock,代码行数:10,代码来源:PyQtPiClock.py

示例12: main

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def main():
  Global.app = QtGui.QApplication(sys.argv)
  Global.app.setStyleSheet("QGroupBox { border: 1px solid gray; } QGroupBox::title { padding: 0 5px; }")

  Global.appPath = os.path.abspath(os.path.join(__file__, '..'))
  Global.loadConfig()

  Global.project = Project()
  Global.simulationForm = SimulationForm()
  Global.architectureForm = ArchitectureForm()
  Global.nodeInformationForm = NodeInformationForm()
  Global.outputForm = OutputForm()
  Global.mainForm = MainForm()

  # Create and display the splash screen
  start = time.time()
  splash_pix = QtGui.QPixmap(Global.appPath + '/images/splash.png')
  splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
  splash.setMask(splash_pix.mask())
  splash.show()
  while time.time() - start < 3:
    time.sleep(0.001)
    Global.app.processEvents()
  splash.close()

  # Show start form
  startForm = StartForm()
  startForm.show()

  deploymentBuild = os.getenv("NUPIC_STUDIO_DEPLOYMENT_BUILD", False)
  if deploymentBuild:
    sys.exit(0)
  else:
    sys.exit(Global.app.exec_()) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:36,代码来源:program.py

示例13: init_ui

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def init_ui(self):
        """Init the ui."""
        self.id = 11
        self.setFixedSize(self.field_width, self.field_height)
        self.setPixmap(QtGui.QPixmap(EMPTY_PATH).scaled(
                self.field_width*3, self.field_height*3))
        self.setStyleSheet("QLabel {background-color: blue;}") 
开发者ID:duguyue100,项目名称:minesweeper,代码行数:9,代码来源:gui.py

示例14: info_label

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def info_label(self, indicator):
        """Set info label by given settings.

        Parameters
        ----------
        indicator : int
            A number where
            0-8 is number of mines in srrounding.
            12 is a mine field.
        """
        if indicator in xrange(1, 9):
            self.id = indicator
            self.setPixmap(QtGui.QPixmap(NUMBER_PATHS[indicator]).scaled(
                    self.field_width, self.field_height))
        elif indicator == 0:
            self.id == 0
            self.setPixmap(QtGui.QPixmap(NUMBER_PATHS[0]).scaled(
                    self.field_width, self.field_height))
        elif indicator == 12:
            self.id = 12
            self.setPixmap(QtGui.QPixmap(BOOM_PATH).scaled(self.field_width,
                                                           self.field_height))
            self.setStyleSheet("QLabel {background-color: black;}")
        elif indicator == 9:
            self.id = 9
            self.setPixmap(QtGui.QPixmap(FLAG_PATH).scaled(self.field_width,
                                                           self.field_height))
            self.setStyleSheet("QLabel {background-color: #A3C1DA;}")
        elif indicator == 10:
            self.id = 10
            self.setPixmap(QtGui.QPixmap(QUESTION_PATH).scaled(
                    self.field_width, self.field_height))
            self.setStyleSheet("QLabel {background-color: yellow;}")
        elif indicator == 11:
            self.id = 11
            self.setPixmap(QtGui.QPixmap(EMPTY_PATH).scaled(
                    self.field_width*3, self.field_height*3))
            self.setStyleSheet('QLabel {background-color: blue;}') 
开发者ID:duguyue100,项目名称:minesweeper,代码行数:40,代码来源:gui.py

示例15: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPixmap [as 别名]
def __init__(self):
        super(donationWidget, self).__init__()
        img = gui.QPixmap("icons/donate.png")
        self.setPixmap(img)
        self.setAlignment(core.Qt.AlignCenter)
        self.setFrameStyle((widgets.QFrame.Panel | widgets.QFrame.StyledPanel)) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:8,代码来源:ddt4all.py


注:本文中的PyQt4.QtGui.QPixmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。