سؤال

Can I use pixel positioning for widgets in PyQt? I mean like in Visual Studio - you can set positions of your widget (interface object).

It's so uncomfortably to position this widgets using some grids and layers. It's not just uncomfortably, I can't make simple interface.

هل كانت مفيدة؟

المحلول

Yes, you can set their position with pixels.

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 مع الإسناد
لا تنتمي إلى StackOverflow
scroll top