我已經設置了移動到點(100,65)的按鈕,所以我猜(100,65)應該是按鈕的頂部左角點,但事實並非如此。輸出仍然爲PyQt4.QtCore.QRect(0, 0, 100, 30)
,爲什麼?不應該是PyQt4.QtCore.QRect(100, 65, 100, 30)
?無論我如何移動按鈕,button.rect()的值都不會改變
import sys
from PyQt4 import QtCore, QtGui
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.button = QtGui.QPushButton('Button', self)
self.button.move(100, 65)
self.setGeometry(300, 300, 280, 150)
print "In Window", self.button.rect()
self.show()
app = QtGui.QApplication([])
ex = Example()
sys.exit(app.exec_())