This article mainly introduced the PYQT5 every day must learn the window separates, has the certain reference value, the interest small partner may refer to
Qsplitter enables the user to control the size of the sub-panel by dragging the boundaries of the sub-panel. In our case, we used two qsplitter to separate three qframe controls from each other.
#!/usr/bin/python3#-*-coding:utf-8-*-"" "PYQT5 Tutorial This example shows how to use Qsplitter parts. Author: My World You've been to the blog: Http://blog.csdn.net/weiaitaowang Last edited: August 4, 2016 "" "Import sysfrom pyqt5.qtwidgets Import ( Qapplication, Qwidget, Qhboxlayout, Qframe, Qsplitter) from Pyqt5.qtcore import Qtclass Example (qwidget): def __init__ (SE LF): Super (). __init__ () Self.initui () def initui (self): Hbox = Qhboxlayout (self) topleft = Qframe Pleft.setframeshape (qframe.styledpanel) TopRight = Qframe (self) topright.setframeshape (qframe.styledpanel) Bottom = Qframe (self) bottom.setframeshape (qframe.styledpanel) splitter1 = Qsplitter (qt.horizontal) splitter1.addwidget (TopLeft) Splitter1.addwidget (topright) Splitter2 = Qsplitter (qt.vertical) splitter2.addwidget (splitter1) spli Tter2.addwidget (bottom) hbox.addwidget (splitter2) self.setlayout (Hbox) self.setgeometry (+, +) se Lf.setwindowtitle (' window delimited ') self.show () if __name__ = = ' __main__ ': app = Qapplication (SYS.ARGV) ex = Example () sys.exit (App.exec_ ())
In our example, we used three frame parts and two qsplitter. Note that the qsplitter boundaries of some topics may not be visible.
TopLeft = Qframe (self)
Topleft.setframeshape (Qframe.styledpanel)
We add Styledpanel styles to the Qframe control to make the bounds between the qframe controls more pronounced.
Splitter1 = Qsplitter (qt.horizontal)
Splitter1.addwidget (TopLeft)
Splitter1.addwidget (TopRight)
We created a Qsplitter control and added two qframe in.
Splitter2 = Qsplitter (qt.vertical)
Splitter2.addwidget (Splitter1)
We can also add a splitter to another splitter widget. We can also add one qsplitter to another qsplitter control.
After the program executes