[問題] 請問 PyQt5 視窗大小
Window 7 x64
PyQt5 (5.8)
請問 frameGeometry 跟 geometry 是不是弄反了?
根據官網的定義
http://doc.qt.io/qt-5.8/application-windows.html#window-geometry
理論上 frameGeometry 會比 geometry 大一點,因為邊框的緣故
但我實際上執行後的結果卻是相反的,請問是不是我弄錯了什麼?
如下,是我的程式碼,感謝
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
class Example(QMainWindow):
def __init__(self, parent = None):
super().__init__(parent)
self.initUI()
def initUI(self):
self.resize(500, 500)
print(self.frameGeometry()) # PyQt5.QtCore.QRect(0, 0, 499, 499)
print(self.geometry()) # PyQt5.QtCore.QRect(0, 0, 500, 500)
self.setWindowTitle('Simple')
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.174.146.37
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1487410853.A.ECA.html
→
02/18 18:54, , 1F
02/18 18:54, 1F
→
02/18 18:55, , 2F
02/18 18:55, 2F
→
02/18 19:06, , 3F
02/18 19:06, 3F
→
02/18 23:45, , 4F
02/18 23:45, 4F