Python PySide.QtGui 模块,QDesktopWidget() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用PySide.QtGui.QDesktopWidget()

项目:HORD    作者:ilija139    | 项目源码 | 文件源码
def GUI():
    # Use logger
    logging.basicConfig(filename="./pySOT_GUI.log",
                        level=logging.INFO)
    app = QtGui.QApplication(sys.argv)
    ex = myGUI()
    qr = ex.frameGeometry()
    cp = QtGui.QDesktopWidget().availableGeometry().center()
    qr.moveCenter(cp)
    ex.move(qr.topLeft())
    ex.setFixedSize(800, 590)
    ex.show()
    sys.exit(app.exec_())
项目:pyside_notification    作者:GrandLoong    | 项目源码 | 文件源码
def __init__(self, mssg=''):
        super(Notification, self).__init__()
        MSSG = mssg
        self.desktop = QtGui.QDesktopWidget()
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.SubWindow)
        self.setupUi(self)
        self.app_dir = os.path.dirname(__file__)
        self.f = 1.0
        self.x = self.desktop.availableGeometry().width()
        self.workThread = WorkThread()
        self.set_transparency(True)
        self.label_icon.setIcon(QtGui.QIcon(self.add_icon('push-notification.png')))
        self.createNotification(MSSG)
项目:3D_Software_and_Python    作者:p4vv37    | 项目源码 | 文件源码
def center(self):
        """
        Function places window on the center of the screen. It is not neccesary for script to run.
        """

        qr = self.frameGeometry()
        cp = QtGui.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def init_display(self, backend_str=None, size=(1024, 768)):

        global display, start_display, app, _, USED_BACKEND

        if not backend_str:
            USED_BACKEND = self.get_backend()
        elif backend_str in [ 'pyside', 'pyqt4']:
            USED_BACKEND = backend_str
        else:
            raise ValueError("You should pass either 'qt' or 'tkinter' to the init_display function.")
            sys.exit(1)

        # Qt based simple GUI
        if USED_BACKEND in ['pyqt4', 'pyside']:
            if USED_BACKEND == 'pyqt4':
                from PyQt4 import QtCore, QtGui, QtOpenGL
                from OCC.Display.pyqt4Display import qtViewer3d
            elif USED_BACKEND == 'pyside':
                from PySide import QtCore, QtGui, QtOpenGL
                from OCC.Display.pysideDisplay import qtViewer3d

        self.ui.modelTab = qtViewer3d(self)
        # self.ui.model2dTab = qtViewer3d(self)

        self.setWindowTitle("Osdag-%s 3d viewer ('%s' backend)" % (VERSION, USED_BACKEND))
        self.ui.mytabWidget.resize(size[0], size[1])
        self.ui.mytabWidget.addTab(self.ui.modelTab, "")
        # self.ui.mytabWidget.addTab(self.ui.model2dTab,"")

        self.ui.modelTab.InitDriver()
        display = self.ui.modelTab._display
        # display_2d = self.ui.model2dTab._display


        # background gradient
        display.set_bg_gradient_color(23, 1, 32, 23, 1, 32)
        # display_2d.set_bg_gradient_color(255,255,255,255,255,255)
        # display black trihedron
        display.display_trihedron()
        display.View.SetProj(1, 1, 1)
        def centerOnScreen(self):
                    '''Centers the window on the screen.'''
                    resolution = QtGui.QDesktopWidget().screenGeometry()
                    self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
                              (resolution.height() / 2) - (self.frameSize().height() / 2))
        def start_display():

            self.ui.modelTab.raise_()
            # self.ui.model2dTab.raise_()   # make the application float to the top

        return display, start_display