from PyQt5.QtCore import Qt, QDir from PyQt5.QtGui import QStandardItemModel, QStandardItem from PyQt5.QtWidgets import QApplication, QColumnView app = QApplication([]) columnView = QColumnView() # Create a model with data model = QStandardItemModel() rootItem = model.invisibleRootItem() for i in range(3): parentItem = QStandardItem('Parent %s' % i) for j in range(3): childItem = QStandardItem('Child %s' % j) parentItem.appendRow(childItem) rootItem.appendRow(parentItem) # Set the model for the column view columnView.setModel(model) # Show the column view columnView.show() app.exec_()This code creates an instance of QApplication and QColumnView. It then creates a QStandardItemModel, which is used to hold the data that will be displayed in the QColumnView. The model is populated with some hierarchical data and then set as the model for the QColumnView. Finally, the QColumnView is shown by calling its show() method. Package library: PyQt5.