import  sys
from PyQt5.QtWidgets import *
def on_click():
    print("ok1")
    print("widget.x()=%d" %widget.x()) #250   窗口横坐标
    print("widget.y()=%d" %widget.y()) #200   窗口纵坐标
    print("widget.width()=%d" % widget.width()) #300   工作区宽度
    print("ok2")
    print("widget.geometry.x()=%d" % widget.geometry().x()) # 250 工作区横坐标
    print("widget.geometry.y()=%d" % widget.geometry().y()) #222   工作区纵坐标
    print("widget.width()=%d" % widget.width())
    print("ok3")
    print("widget.framegeometry.x()=%d" % widget.frameGeometry().x())
    print("widget.framegeometry.y()=%d" % widget.frameGeometry().y())
    print("widget.width()=%d" % widget.frameGeometry().width())  # 窗口宽度
App = QApplication(sys.argv)

widget = QWidget()
btn =QPushButton(widget)
btn.setText("按钮")
btn.move(20,30)
btn.clicked.connect(on_click)
widget.resize(300,300)
widget.move(250,200)
widget.setWindowTitle("屏幕坐标系")
widget.show()
sys.exit(App.exec_())