[英]Python PyQt widgets positioning in pixels
我可以在PyQt中為小部件使用像素定位嗎? 我的意思是在Visual Studio中 - 您可以設置窗口小部件的位置(接口對象)。
使用一些網格和圖層來定位這些小部件是非常不舒服的。 這不僅令人不舒服,我無法制作簡單的界面。
是的,您可以使用像素設置其位置。
widget.setGeometry(QtCore.QRect(x_pos, y_pos, x_size, y_size))
# A button located at (300, 425) of size 500 by 100
self.btn_example.setGeometry(QtCore.QRect(300, 425, 500, 100))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.