如何在pyqt4 python中自动调整大小?

时间:2015-05-06 09:59:56

标签: python python-2.7 pyqt4

enter image description here

当用户调整主窗口大小时,我想以下面显示的尺寸自动调整上面的图片。

pyqt4中是否有任何功能?

enter image description here

我正在寻找这个问题的答案......但我无法找到相关的东西。

我试图设定固定的最小尺寸,但这不起作用。

如何在pyqt4(python)中自动调整窗口大小?

图片来自qtdesigner。

1 个答案:

答案 0 :(得分:2)

如果您使用的是QtDesigner,那么它非常简单。看看像vertical layout, horizontal layout这样的布局 按照步骤:

1. Add layout to your main window.
2. Right click main window and click 'layout vertically' as you want button below 
   the text area
3. Then add(drag-n-drop) your text area inside vertical area.
4. Add button and what not....
5. Have a look at  'http://doc.qt.io/qt-4.8/designer-layouts.html' google for    
   properties of layout like alignment of element. size, orientation.
相关问题