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


Python QDesktopWidget.screenGeometry方法代码示例

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


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

示例1: setupUi

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import screenGeometry [as 别名]
    def setupUi( self ):
        super( dlgUserLogin, self ).setupUi()

        #No mostrar el marco de la ventana
        self.setWindowFlags( Qt.FramelessWindowHint )

        self.resize( 519, 311 )
        self.setMinimumSize( QSize( 519, 311 ) )
        self.setMaximumSize( QSize( 519, 311 ) )

        horizontal_layout = QHBoxLayout( self )
        horizontal_layout.setMargin( 0 )

        frame = QFrame( self )
        frame.setFrameShape( QFrame.NoFrame )
        frame.setFrameShadow( QFrame.Plain )

        grid_layout = QGridLayout( frame )
        grid_layout.setMargin( 0 )

        spacerItem = QSpacerItem( 20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding )
        grid_layout.addItem( spacerItem, 0, 0, 1, 6 )



        sizePolicy = QSizePolicy( QSizePolicy.Preferred,
                                  QSizePolicy.Maximum )
        sizePolicy.setHorizontalStretch( 0 )
        sizePolicy.setVerticalStretch( 0 )
        sizePolicy.setHeightForWidth( self.txtApplication.sizePolicy().hasHeightForWidth() )
        self.txtApplication.setSizePolicy( sizePolicy )

        font = QFont()
        font.setPointSize( 16 )
        font.setWeight( 75 )
        font.setBold( True )
        self.txtApplication.setFont( font )
        self.txtApplication.setAutoFillBackground( False )
        self.txtApplication.setAlignment( Qt.AlignCenter )

        grid_layout.addWidget( self.txtApplication, 1, 0, 1, 5 )
        spacer_item_1 = QSpacerItem( 20, 40, QSizePolicy.Minimum,
                                   QSizePolicy.Expanding )
        grid_layout.addItem( spacer_item_1, 2, 0, 1, 6 )
        spacer_item_2 = QSpacerItem( 20, 40, QSizePolicy.Minimum,
                                   QSizePolicy.Expanding )
        grid_layout.addItem( spacer_item_2, 3, 0, 1, 6 )
        spacer_item_3 = QSpacerItem( 60, 20, QSizePolicy.Expanding,
                                   QSizePolicy.Minimum )
        grid_layout.addItem( spacer_item_3, 5, 0, 1, 1 )
        spacer_item_4 = QSpacerItem( 40, 20, QSizePolicy.Expanding,
                                   QSizePolicy.Minimum )
        grid_layout.addItem( spacer_item_4, 5, 1, 1, 1 )
        spacer_item_6 = QSpacerItem( 40, 20, QSizePolicy.Expanding,
                                   QSizePolicy.Minimum )
        grid_layout.addItem( spacer_item_6, 5, 2, 1, 1 )


        self.label = QLabel()

        self.txtBd = QLineEdit()

        self.formLayout.addRow( u"Base de datos", self.txtBd )
        self.formLayout.setFieldGrowthPolicy( QFormLayout.ExpandingFieldsGrow )

        grid_layout.addLayout( self.formLayout, 5, 3, 1, 1 )
        spacer_item_6 = QSpacerItem( 40, 20, QSizePolicy.Expanding,
                                   QSizePolicy.Minimum )
        grid_layout.addItem( spacer_item_6, 5, 4, 1, 1 )
        spacer_item_7 = QSpacerItem( 40, 20, QSizePolicy.Expanding,
                                   QSizePolicy.Minimum )
        grid_layout.addItem( spacer_item_7, 5, 5, 1, 1 )
        self.lblError = QLabel( frame )
        self.lblError.setProperty( "error", True )
        grid_layout.addWidget( self.lblError, 6, 3, 1, 2 )
        spacer_item_8 = QSpacerItem( 20, 40, QSizePolicy.Minimum,
                                   QSizePolicy.Expanding )
        grid_layout.addItem( spacer_item_8, 7, 0, 1, 6 )
        self.buttonbox = QDialogButtonBox( frame )
        self.buttonbox.setOrientation( Qt.Horizontal )
        self.buttonbox.setStandardButtons( QDialogButtonBox.Cancel |
                                           QDialogButtonBox.Ok )
        grid_layout.addWidget( self.buttonbox, 8, 0, 1, 5 )
        spacer_item_9 = QSpacerItem( 20, 40, QSizePolicy.Minimum,
                                   QSizePolicy.Expanding )
        grid_layout.addItem( spacer_item_9, 9, 0, 1, 6 )
        horizontal_layout.addWidget( frame )


        self.txtApplication.setText( "%s : %s" % ( qApp.organizationName(),
                                                qApp.applicationName() ) )
        self.lblError.setVisible( False )

        #Centrar el dialogo en la pantalla
        desktop_widget = QDesktopWidget()
        geometry = desktop_widget.screenGeometry()
        self.setGeometry( ( geometry.width() - 519 ) / 2,
                           ( geometry.height() - 311 ) / 2  ,
                            519, 311 )
#.........这里部分代码省略.........
开发者ID:armonge,项目名称:EsquipulasPy,代码行数:103,代码来源:user.py


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