PySideでスクリーンサイズを取得する

QApplicationオブジェクトのdesktopメソッドで、

QDesktopWidgetオブジェクトが取得できる。

このオブジェクトからデスクトップの情報を取得することができる。

以下のサンプルコードでは、

例としてデスクトップの左半分にウィンドウを表示している。

import sys
from PySide import QtCore, QtGui

app = QtGui.QApplication(sys.argv)
desktop = app.desktop()

height = desktop.height()
width = desktop.width()

window = QtGui.QMainWindow()
window.setGeometry(0, 0, width/2, height)
window.show()
sys.exit(app.exec_())