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


Python QGuiApplication.primaryScreen方法代码示例

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


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

示例1: handle_click

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import primaryScreen [as 别名]
    def handle_click(self, reason):
        if reason != QSystemTrayIcon.Trigger:
            return

        QGuiApplication.primaryScreen().grabWindow(0).save('scr.jpg', 'jpg')
        ssh = SSHClient()
        ssh.load_system_host_keys()
        ssh.connect(hostname=self.ssh_hostname, port=self.ssh_port, username=self.ssh_username)
        scp = SCPClient(ssh.get_transport())
        dest_name = time.strftime("screenshot_%Y%m%d_%H%M%S.jpg", time.localtime())
        scp.put('scr.jpg', self.ssh_remote_path + '/' + dest_name)
开发者ID:jpodeszwik,项目名称:linux_screenshoter,代码行数:13,代码来源:linux_screenshoter.py

示例2: __init__

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import primaryScreen [as 别名]
    def __init__(self, parent=None, **kwargs):
        super(BasePlotWidget, self).__init__(parent=parent, **kwargs)

        self.setActiveCurveHandling(False)
        self.setGraphGrid('both')

        # Create toolbars.
        self._interactiveModeToolBar = tools.toolbars.InteractiveModeToolBar(
            parent=self, plot=self)
        self.addToolBar(self._interactiveModeToolBar)

        self._toolBar = QToolBar('Curve or Image', parent=self)
        self._resetZoomAction = actions.control.ResetZoomAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._resetZoomAction)

        self._xAxisAutoScaleAction = actions.control.XAxisAutoScaleAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._xAxisAutoScaleAction)

        self._yAxisAutoScaleAction = actions.control.YAxisAutoScaleAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._yAxisAutoScaleAction)

        self._gridAction = actions.control.GridAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._gridAction)

        self._curveStyleAction = actions.control.CurveStyleAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._curveStyleAction)

        self._colormapAction = actions.control.ColormapAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._colormapAction)

        self._keepAspectRatio = actions.control.KeepAspectRatioAction(
            parent=self, plot=self)
        self._toolBar.addAction(self._keepAspectRatio)

        self.addToolBar(self._toolBar)

        self._outputToolBar = tools.toolbars.OutputToolBar(
            parent=self, plot=self)
        self.addToolBar(self._outputToolBar)

        windowHandle = self.window().windowHandle()
        if windowHandle is not None:
            self._ratio = windowHandle.devicePixelRatio()
        else:
            self._ratio = QGuiApplication.primaryScreen().devicePixelRatio()

        self._snap_threshold_dist = 5

        self.sigPlotSignal.connect(self._plotEvent)
开发者ID:mretegan,项目名称:crispy,代码行数:57,代码来源:plot.py

示例3: impl

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import primaryScreen [as 别名]
    def impl(self):
        try:
            # Change the visibility of the *selected* layer
            self.o2.visible = False

            # Make sure the GUI is caught up on paint events
            QApplication.processEvents()

            # We must sleep for the screenshot to be right.
            time.sleep(0.1)

            self.w.repaint()

            screen = QGuiApplication.primaryScreen()

            # Capture the window before we change anything
            beforeImg = screen.grabWindow(self.w.winId()).toImage()

            # Change the visibility of the *selected* layer
            self.o2.visible = True

            self.w.repaint()

            # Make sure the GUI is caught up on paint events
            QApplication.processEvents()

            # We must sleep for the screenshot to be right.
            time.sleep(0.1)

            # Capture the window now that we've changed a layer.
            afterImg = screen.grabWindow(self.w.winId()).toImage()

            # Optional: Save the files so we can inspect them ourselves...
            # beforeImg.save('before.png')
            # afterImg.save('after.png')

            # Before and after should NOT match.
            assert beforeImg != afterImg
        except:
            # Catch all exceptions and print them
            # We must finish so we can quit the app.
            import traceback

            traceback.print_exc()
            TestLayerWidget.errors = True

        qApp.quit()
开发者ID:ilastik,项目名称:volumina,代码行数:49,代码来源:layerwidget_test.py

示例4: _screenScaleFactor

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import primaryScreen [as 别名]
 def _screenScaleFactor(self):
     physical_dpi = QGuiApplication.primaryScreen().physicalDotsPerInch()
     # Typically 'normal' screens have a DPI around 96. Modern high DPI screens are up around 220.
     # We scale the low DPI screens with a traditional 1, and double the high DPI ones.
     return 1.0 if physical_dpi < 150 else 2.0
开发者ID:senttech,项目名称:Uranium,代码行数:7,代码来源:QtApplication.py


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