Skip to content

Instantly share code, notes, and snippets.

@oglops
Created February 15, 2016 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oglops/af0f7c648f87002386c6 to your computer and use it in GitHub Desktop.
Save oglops/af0f7c648f87002386c6 to your computer and use it in GitHub Desktop.
QTreeView + QFileSystemModel
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Window(QMainWindow):
'This time I try to put the table populating code in main ui'
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.model = QFileSystemModel()
self.model.setRootPath(QDir.currentPath())
tree = QTreeView()
tree.setModel(self.model)
self.setCentralWidget(tree)
self.resize(350, 220)
def main(args):
app = QApplication(args)
window = Window()
window.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment