Python GUI编程网 > PyQt5高级控件 > QTreeView树视图控件
python教程

QTreeView树视图控件

发布日期:2021年4月24日 22:56
阅读:2203
作者:Python GUI编程网

QTreeView树视图控件

00:00 / 01:23
1x
2x
1.5x
1.25x
1x
0.8x
0.5x

QTreeView树视图控件

################################
# PyQt5中文网 - PyQt5全套视频教程 #
#    https://www.PyQt5.cn/     #
#         主讲: 村长            #
################################

from PyQt5.Qt import *
import sys

class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("高级控件-QTreeView树视图控件 - PyQt5中文网")
        self.resize(600, 500)
        self.func_list()

    def func_list(self):
        self.func()

    def func(self):
        model = QDirModel()
        tree = QTreeView(self)
        tree.setModel(model)
        tree.setWindowTitle('当前目录')
        tree.resize(400, 350)
        pass


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()

    window.show()
    sys.exit(app.exec_())