ドッキングウィンドウ

2014/12/14

Python2.7.6, pyQt4.11

# -*- coding: utf-8 -*-

import sys
from PyQt4 import Qt
from PyQt4 import QtGui

def main():

    app = QtGui.QApplication(sys.argv)
    w = QtGui.QMainWindow()

    top_dock = QtGui.QDockWidget('Top',w)
    top_dock.setWidget(QtGui.QWidget())
    w.addDockWidget(Qt.Qt.TopDockWidgetArea, top_dock)

    left_dock = QtGui.QDockWidget('Left',w)
    left_dock.setWidget(QtGui.QWidget())
    w.addDockWidget(Qt.Qt.LeftDockWidgetArea, left_dock)

    right_dock = QtGui.QDockWidget('Right',w)
    right_dock.setWidget(QtGui.QWidget())
    w.addDockWidget(Qt.Qt.RightDockWidgetArea, right_dock)

    bottom_dock = QtGui.QDockWidget('Bottom',w)
    bottom_dock.setWidget(QtGui.QWidget())
    w.addDockWidget(Qt.Qt.BottomDockWidgetArea, bottom_dock)

    center_widget = QtGui.QWidget()
    label = QtGui.QLabel('Center',center_widget)
    w.setCentralWidget(center_widget)

    w.resize(320,240)
    w.show()

    sys.exit(app.exec_())

if __name__ == '__main__':
    main()


PyQt4 のメインウィンドウの構成を把握する
http://t2y.hatenablog.jp/entry/20100917/1284652234