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


Python QImage.fromData方法代码示例

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


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

示例1: copy_clipboard

# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import fromData [as 别名]
    def copy_clipboard(self):
        from io import BytesIO

        buf = BytesIO()
        self.fig.savefig(buf)
        QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
        buf.close()
开发者ID:peace098beat,项目名称:GAnalyser2,代码行数:9,代码来源:BaseCanvas.py

示例2: clipboard_handler

# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import fromData [as 别名]
 def clipboard_handler(event):
     if event.key == 'ctrl+c':
         # store the image in a buffer using savefig(), this has the
         # advantage of applying all the default savefig parameters
         # such as background color; those would be ignored if you simply
         # grab the canvas using Qt
         buf = io.BytesIO()
         fig.savefig(buf)
         QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
         buf.close()
开发者ID:dilawar,项目名称:Scripts,代码行数:12,代码来源:python_import_default.py

示例3: _setWallpaper

# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import fromData [as 别名]
    def _setWallpaper(self, url, offset, width):
        inStream = urllib2.urlopen(url)
        img = QImage.fromData(inStream.read())
        img = img.scaledToHeight(854,Qt.SmoothTransformation)
        #offset = int(img.width() / 2) - 240
        print 'offset:', offset, 'img.width', img.width(), 'width', width
        img = img.copy(offset, 0, 480, 854)
        img.save(WALLPATH)

        #Set in gconf
        import gconf
        gclient = gconf.client_get_default()
        gclient.set_string(GCONFKEY, '')
        gclient.set_string(GCONFKEY, \
                           WALLPATH)
        #Emit done signal
        self._set_running(False)
        self.done.emit()
开发者ID:AnadoluPanteri,项目名称:Wleux,代码行数:20,代码来源:__init__.py

示例4: takeSnapshot

# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import fromData [as 别名]
 def takeSnapshot(self, path):
     '''
     screen capture in png format
     :param path: saved file path
     :return: None
     '''
     p1 = self.cmd.popen(['screencap', '-p'], stdout=PIPE)
     p = Popen(['perl', '-pe', 's/\x0D\x0D\x0A/\x0A/g'], stdin=p1.stdout, stdout=PIPE)
     out, error = p.communicate()
     ba = QByteArray.fromRawData(out)
     img = QImage.fromData(ba, 'PNG')
     orient = self.getCurrDisplay()['orientation']
     if orient == 1:
         img = img.transformed(QMatrix().rotate(-90))
     elif orient == 2:
         img = img.transformed(QMatrix().rotate(-180))
     elif orient == 3:
         img = img.transformed(QMatrix().rotate(-270))
     img.save(path, 'PNG')
开发者ID:ChenYuTingJerry,项目名称:AutoSense_2,代码行数:21,代码来源:Adb.py

示例5: copy_to_clipboard

# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import fromData [as 别名]
 def copy_to_clipboard(self):
     img_buffer = io.BytesIO()
     self.figure.savefig(img_buffer)
     QApplication.clipboard().setImage(QImage.fromData(img_buffer.getvalue()))
     img_buffer.close()
开发者ID:AustralianSynchrotron,项目名称:pdviper,代码行数:7,代码来源:mpl_plot.py


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