6

I am using python and PyQt to design a simple interface.

My question is this:

How do I set an initial width of a pyqt widget in a splitter while still allowing it to be modified by the user when they drag the divider?

I want one of the two widgets in the splitter to be narrower when the application first launches and I also want the user to be able to manually change the width by dragging on the divider. I tried setting the maximum width in Qt-Designer and then when the application launches the widget is narrower but you can not drag the dividing line to expand it. If I don't set any maximum widths then when the app launches they each take up 50% but I can drag the divider around manually to adjust the ratio.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
jminardi
  • 936
  • 1
  • 11
  • 23

1 Answers1

4

Did you try?:

QSplitter.setSizes (self, list-of-int list)
###Sets the child widgets respective sizes to the values given in the list.

You have here a working example

Community
  • 1
  • 1
joaquin
  • 82,968
  • 29
  • 138
  • 152