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


Python QDesktopWidget.primaryScreen方法代码示例

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


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

示例1: show

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import primaryScreen [as 别名]
 def show(self):
     self.visible = True
     WindowBaseClass.show(self)
     desktop = QDesktopWidget()
     rect = desktop.availableGeometry(desktop.primaryScreen()) 
     center = rect.center();
     center.setX(center.x() - (self.width()/2));
     center.setY(center.y() - (self.height()/2));
     self.move(center);
开发者ID:sassman,项目名称:iosshy,代码行数:11,代码来源:tunneldialog.py

示例2: __init__

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

		# get primiry monitor resolution
		qdw = QDesktopWidget()

		mainScreenSize = qdw.availableGeometry(qdw.primaryScreen())
		# get center of the monitor
		center = mainScreenSize.center()
		# calculate width, height and x,y positions of the window
		r_width = round(mainScreenSize.width()/2)
		r_height = round(mainScreenSize.height()/2)
		r_x = round(center.x()-r_width/2)
		r_y = round(center.y()-r_height/2)
		
		# set default geometry of the window
		rect = QRect()
		rect.setX(r_x)
		rect.setY(r_y)
		rect.setWidth(r_width)
		rect.setHeight(r_height)
		self.setGeometry(rect)
开发者ID:pgollor,项目名称:pyGUI,代码行数:24,代码来源:customDialogs.py

示例3: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import primaryScreen [as 别名]
    def __init__(self, parent=None, workdir=None, fontsize=42):
        super(BillboardDisplay, self).__init__(parent)
        self.workdir = workdir
        self.logger = logging.getLogger('display')
        self.logger.info('Working directory: {}'.format(self.workdir))
        self.current_display = os.path.join(self.workdir, 'current.jpg')
        desktop = QDesktopWidget()
        self.display = QWidget(self)
        size  = desktop.availableGeometry(desktop.primaryScreen());
        self.display.resize(size.width(), size.height())
        self.display.setWindowTitle("Billboard")

        self.image_label = QLabel(self.display)
        self.image_label.resize(size.width(), size.height())

        self.text_label = QLabel(self.display)
        self.text_label.resize(size.width(), size.height())
        self.text_label.setMargin(100)
        self.text_label.setStyleSheet('''
            QLabel {{
                        font-size: {}pt;
                        font-weight: bold;
                        color: #eeeeee;
                        text-align: center;
                    }}
        '''.format(fontsize))
        self.text_label.setWordWrap(True)
        self.text_label.setAlignment(Qt.AlignCenter)

        dse = QGraphicsDropShadowEffect()
        dse.setBlurRadius(0)
        dse.setXOffset(5)
        dse.setYOffset(5)
        dse.setColor(QColor(0, 0, 0, 255))
        self.text_label.setGraphicsEffect(dse)
        QObject.connect(self, SIGNAL("updateimage"),
                        self.display_image)
        QObject.connect(self, SIGNAL("updatecurrent"),
                        self.take_screenshot)
开发者ID:setrofim,项目名称:billboard,代码行数:41,代码来源:display.py

示例4: height

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import primaryScreen [as 别名]
def height():
    widget = QDesktopWidget()
    rec = widget.availableGeometry(widget.primaryScreen())
    return rec.height()
开发者ID:loongfee,项目名称:Roam,代码行数:6,代码来源:roam_style.py


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