Pyqt how to get a widget's dimensions

前端 未结 3 1572
说谎
说谎 2020-12-06 16:57

I am currently developing an application in which i cannot use modal windows (due to some application constraints). However, in some cases i would like to simulate a popup w

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 17:59

    For getting Qt Widget size:

    import sys
    from PyQt4 import QtGui, QtCore
    
    app = QtGui.QApplication(sys.argv)
    
    mainWindow = QtGui.QWidget()
    width = mainWindow.frameGeometry().width()
    height = mainWindow.frameGeometry().height()
    

提交回复
热议问题