简体   繁体   中英

PyQt5: Positioning widgets

Code: http://pastebin.com/xKuabn8b

I am creating a gui in python QT and have a problem where I cant position my label properly because Im using a grid layout. If you see my code and run it, youll see that the "LP" label is to the side when in fact, I want it next to my radioButton. I have 3 other radio buttons I want adding once I figure out whats the best way to place them along with there labels next to them.

I have been researching how to use a QHBoxLayout to maybe fix the issue but it just positions it in the middle of my gui. Would I need to use absolute positioning to line it up or is there a way to use my GridLayout I have?

Prefered solution: set the label directly to the radio button as a parameter in the constructor.

Solution 2: use addStretch method from QHBoxLayout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM