PyQt5 之QFrame
一、对照效果
二、常用API
1、框架形状
setFrameShape(QFrame.Shape)
2、框架阴影
setFrameShadow(QFrame.Shadow)
3、框架的几个线宽
4、框架样式
5、框架矩形
三、示例
from PyQt5.Qt import * import sys class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle(‘QFrame-使用‘) self.resize(500, 400) self.setup_ui() def setup_ui(self): frame = QFrame(self) frame.setFrameStyle(QFrame.Box | QFrame.Raised) frame.setLineWidth(2) frame.setMidLineWidth(12) frame.setStyleSheet(‘background-color: green‘) frame.setFrameRect(QRect(10, 10, 80, 80)) frame.resize(100, 100) frame.move(100, 100) if __name__ == ‘__main__‘: app = QApplication(sys.argv) window = Window() window.show() sys.exit(app.exec_())
相关推荐
meylovezn 2020-09-15
zhongfuyu 2020-08-16
JimyFengqi 2020-08-16
追逐阳光的风 2020-07-04
hustlei 2020-06-21
lianback 2020-06-21
王磊的程序员之路 2020-06-21
kikaylee 2020-06-12
生物信息学 2020-06-07
hustlei 2020-06-04
zhongfuyu 2020-05-30
hustlei 2020-05-19
zhongfuyu 2020-05-19
zhongfuyu 2020-05-14
JasonYeung 2020-05-09
bcbeer 2020-04-23