[PyQt] Layout addWidget alignment

Phil Thompson phil at riverbankcomputing.com
Wed Jul 1 19:16:07 BST 2015


On 01/07/2015 7:07 pm, Baz Walter wrote:
> On 01/07/15 17:40, Esteban Martinena Guerrero wrote:
>> Hi,
>> 
>> The addWidget method of the Layouts accepts 3 arguments. If you set 
>> the
>> alignment for any widget in a layout tf would be the third argument of 
>> the
>> addWidgetMethod but it's in the second one. This doen't generate any 
>> errors
>> because the second and third parameters are both optional and 
>> integers.
>> 
>> Can anyone tell me if you have the same problem?
> 
> What problem? Either of:
> 
>     layout.addWidget(widget, 0, Qt.AlignCenter)
> 
> or:
> 
>     layout.addWidget(widget, alignment=Qt.AlignCenter)
> 
> work exactly as expected for me.

The problem is that the bad code is generated by pyuic.

Phil


More information about the PyQt mailing list