本文整理汇总了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);
示例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)
示例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)
示例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()