Widget that displays a directory tree?

E

Edward C. Jones

Do any of the Python GUIs have a super-high-level widget that displays a
directory tree? Most file managers or editors have this type of window.
 
P

Phil Thompson

Do any of the Python GUIs have a super-high-level widget that displays a
directory tree? Most file managers or editors have this type of window.

Below is the dirview.py example from the soon-to-be-released PyQt4. Snapshots
are available, including a GPL binary package for Windows for use with the
GPL version of Qt.

Phil


import sys
from PyQt4 import QtCore, QtGui

app = QtGui.QApplication(sys.argv)

model = QtGui.QDirModel()
tree = QtGui.QTreeView()
tree.setModel(model)

tree.setWindowTitle(tree.tr("Dir View"))
tree.resize(640, 480)
tree.show()

sys.exit(app.exec_())
 
C

Christos Georgiou

Do any of the Python GUIs have a super-high-level widget that displays a
directory tree? Most file managers or editors have this type of window.

If you have idle installed, you can check the PathBrowser.py file in your
idlelib directory. (Run idle; click File -> Path Browser to see it in
action, and click File -> Open Module -> PathBrowser -> OK to see/edit the
source).
 
C

Claudio Grondi

Christos said:
If you have idle installed, you can check the PathBrowser.py file in your
idlelib directory. (Run idle; click File -> Path Browser to see it in
action, and click File -> Open Module -> PathBrowser -> OK to see/edit the
source).

C:\>C:\Python24\python.exe
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
C:\>C:\Python24\Lib\idlelib\PathBrowser.py
Traceback (most recent call last):
File "C:\Python24\Lib\idlelib\PathBrowser.py", line 95, in ?
main()
File "C:\Python24\Lib\idlelib\PathBrowser.py", line 90, in main
PathBrowser(PyShell.flist)
AttributeError: 'module' object has no attribute 'flist'

Strange ...

Claudio
 
F

Fredrik Lundh

Claudio said:
Christos said:
If you have idle installed, you can check the PathBrowser.py file in your
idlelib directory. (Run idle; click File -> Path Browser to see it in
action, and click File -> Open Module -> PathBrowser -> OK to see/edit the
source).

C:\>C:\Python24\python.exe
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
C:\>C:\Python24\Lib\idlelib\PathBrowser.py
Traceback (most recent call last):
File "C:\Python24\Lib\idlelib\PathBrowser.py", line 95, in ?
main()
File "C:\Python24\Lib\idlelib\PathBrowser.py", line 90, in main
PathBrowser(PyShell.flist)
AttributeError: 'module' object has no attribute 'flist'

Strange ...

in what way?

the instructions you didn't read told you to run idle, and select the
browser via the menu system to see it in action.

</F>
 
C

Claudio Grondi

Fredrik said:
Claudio Grondi wrote:

Christos said:
Do any of the Python GUIs have a super-high-level widget that displays a
directory tree? Most file managers or editors have this type of window.


If you have idle installed, you can check the PathBrowser.py file in your
idlelib directory. (Run idle; click File -> Path Browser to see it in
action, and click File -> Open Module -> PathBrowser -> OK to see/edit the
source).

C:\>C:\Python24\python.exe
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
C:\>C:\Python24\Lib\idlelib\PathBrowser.py
Traceback (most recent call last):
File "C:\Python24\Lib\idlelib\PathBrowser.py", line 95, in ?
main()
File "C:\Python24\Lib\idlelib\PathBrowser.py", line 90, in main
PathBrowser(PyShell.flist)
AttributeError: 'module' object has no attribute 'flist'

Strange ...


in what way?

the instructions you didn't read told you to run idle, and select the
browser via the menu system to see it in action.

</F>
Yes, you are right. The section
def main():
import PyShell
PathBrowser(PyShell.flist)
if sys.stdin is sys.__stdin__:
mainloop()
in PathBrowser.py suggested (apparent falsely), that it should run also
standalone - that was my problem.
Thank you.

Claudio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top