Alpha93
Alpha93

Reputation: 61

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?

Upvotes: 0

Views: 827

Answers (1)

Dragos Pop
Dragos Pop

Reputation: 458

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

Solution 2: use addStretch method from QHBoxLayout

Upvotes: 1

Related Questions