當前位置: 首頁>>代碼示例>>Python>>正文


Python QRect.width方法代碼示例

本文整理匯總了Python中PyQt4.Qt.QRect.width方法的典型用法代碼示例。如果您正苦於以下問題:Python QRect.width方法的具體用法?Python QRect.width怎麽用?Python QRect.width使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.Qt.QRect的用法示例。


在下文中一共展示了QRect.width方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: screen_pos_size

# 需要導入模塊: from PyQt4.Qt import QRect [as 別名]
# 或者: from PyQt4.Qt.QRect import width [as 別名]
def screen_pos_size(): ###e this copies code in main.py -- main.py should call this
    """
    Return (x,y),(w,h), where the main screen area
    (not including menubar, for Mac) is in a rect of size w,h,
    topleft at x,y. Note that x,y is 0,0 except for Mac.
    Current implementation guesses Mac menubar size since it doesn't
    know how to measure it.
    """
    # Create desktop widget to obtain screen resolution
    dtop = QDesktopWidget()
    screensize = QRect (dtop.screenGeometry (0))

    if is_macintosh():
        # menubar_height = 44 was measured (approximately) on an iMac G5 20 inch
        # screen; I don't know if it's the same on all Macs (or whether it can
        # vary with OS or user settings). (Is there any way of getting this info
        # from Qt? #e)
        menubar_height = 44
    else:
        menubar_height = 0

    screen_w = screensize.width()
    screen_h = screensize.height() # of which menubar_height is in use at the top

    x,y = 0,0
    w,h = screen_w, screen_h

    y += menubar_height
    h -= menubar_height

    return (x,y), (w,h)
開發者ID:alaindomissy,項目名稱:nanoengineer,代碼行數:33,代碼來源:PlatformDependent.py


注:本文中的PyQt4.Qt.QRect.width方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。