本文介绍了在布局 PyQt 之间添加一条间隔线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在两个布局之间添加一条间隔线:
I would like to add a spacer line between two layouts:
Separador = QFrame()
Separador.Shape(QFrame.HLine)
Separador.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding)
Separador.setLineWidth(3)
HPOUT1_layout = QVBoxLayout()
HPOUT1_layout.addLayout(HPOUT1L_layout)
HPOUT1_layout.addWidget(Separador)
HPOUT1_layout.addLayout(HPOUT1R_layout)
然而,这段代码只是将布局分开了一点,但它们之间没有可见的线.还有另一种方法,我做错了什么?
However, this code only separate the layouts a little, but there is no line visible between them. Is there another way, What I'm doing wrong?
推荐答案
您没有正确设置框架的形状.
You are not setting the shape of the frame correctly.
代替
Separador.Shape(QFrame.HLine)
使用
Separador.setFrameShape(QFrame.HLine)
这篇关于在布局 PyQt 之间添加一条间隔线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!