pyqt5螢幕座標系

2022-02-17 10:42:59 字數 1763 閱讀 2855

我們直接用**去理解螢幕座標系

import

sysfrom pyqt5.qtwidgets import

defonclick_button():

print("1"

)

print("

widget.x() = %d

" % widget.x()) #

250 (視窗橫座標)

print("

widget.y() = %d

" % widget.y()) #

200 (視窗縱座標)

print("

widget.width() = %d

" % widget.width()) #

300(工作區寬度)

print("

widget.height() = %d

" % widget.height()) #

240 (工作區高度)

print("2"

)

print("

widget.geometry().x() = %d

" % widget.geometry().x()) #

250 (工作區橫座標)

print("

widget.geometry().y() = %d

" % widget.geometry().y()) #

222 (工作區縱座標)

print("

widget.geometry().width() = %d

" % widget.geometry().width() ) #

300(工作區寬度)

print("

widget.geometry().height() = %d

" % widget.geometry().height()) #

240 (工作區高度)

print("3"

)

print("

widget.framegeometry().x() = %d

" % widget.framegeometry().x()) #

250 (視窗橫座標)

print("

widget.framegeometry().y() = %d

" % widget.framegeometry().y()) #

200 (視窗縱座標)

print("

widget.framegeometry().width() = %d

" % widget.framegeometry().width() ) #

300(視窗寬度)

print("

widget.framegeometry().height() = %d

" % widget.framegeometry().height()) #

262(視窗高度)

widget =qwidget()

btn =qpushbutton(widget)

btn.settext("按鈕

")btn.clicked.connect(onclick_button)

btn.move(24,52)

widget.resize(300,240) #

設定工作區的尺寸

widget.move(250,200)

widget.setwindowtitle(

'螢幕座標系')

widget.show()

pyQt5 視窗座標系

qwidget 包括 標題欄 和邊框 和客戶區 標題欄 就是上圖中的藍色的window title 邊框就是 上圖中的黑灰色的 外框 有一定的寬度 client area 就是 客戶區 灰白色 執行效果 這個是乙個 qwidget 視窗,視窗 包括客戶區,邊框和標題欄 對應的 import sys ...

PyQt5 絕對座標設定位置

1 簡介 pyqt5 絕對座標的方式 設定元件在視窗上的位置 2 功能實現 coding utf 8 簡介 pyqt5中absolute positioning 絕對定位 例子 import sys class example qwidget def init self super init sel...

螢幕座標系

三點定義乙個三角形。當我們在三維圖形學中談論 點 point 時,我們經常說 頂點 vertex 乙個頂點有三個座標 x,y和z。你可以用以下方式來想象這三個座標 x 在你的右方 y 在你的上方 z 是你背後的方向 是的,背後,而不是你的前方 這裡有乙個更形象的方法 使用右手定則 x 是你的拇指 y...