PyQt:从右到左控制
问题描述:
我需要将所有控件右对齐。所以当调整大小时,他们应该移动窗口的右上角而不是左上角。 在visual studio中,我只是将任何控件的Anchor属性设置为正确的。但PyQt没有Anchor或Dock属性。设置layoutDirection
到RightToLeft
没有帮助。PyQt:从右到左控制
注:我正在尝试使用Qt Designer学习PyQt。
答
这是很容易:
# Create a layout
layout = QHBoxLayout()
# create a control
button = QPushButton("button")
# add the button to the layout and align it to the right
layout.addWidget(button, alignment=Qt.AlignRight)
+0
这给了我'TypeError:addWidget()不需要关键字参数' – Azmisov 2014-01-24 00:48:38
我不希望我的停靠控制。我只需要从右侧对齐它们。 – 2010-08-22 14:04:52
链接处于脱机状态,2016年 – Elric 2016-08-09 21:16:07