前言
当我们使用label标签设置label.setPixmap()的时候,设置的图片总是显示一部分.为了让图片能自适应label的大小.需要使用label.setScaledContents(True)
知识点
虽然是pyqt,但是API都看C++的.
查看scaledContents : bool 的属性
This property holds whether the label will scale its contents to fill all available space.
When enabled and the label shows a pixmap, it will scale the pixmap to fill the available space.
This property’s default is false.
这个属性呢保存是否让标签缩放其内容来填充整个可用空间.
当我们启用这个属性标签显示一个图片.它就会缩放图片填充可用空间.
这个属性默认是false.
测试代码
class Test(QWidget):
def

1万+

被折叠的 条评论
为什么被折叠?



