2013-02-21 50 views
0

我有一些pdf文件在不同目錄下的完整路徑,我想在一個窗口中顯示這些文件,用戶可以通過它們和文檔查看器打開它們。FileBrowser使用python顯示來自不同目錄的文件QtGUI

因爲我是新的python和QtGUI,我無法弄清楚如何做到這一點。我曾經看到過,但無法弄清楚它是如何發生的Here is something。當我運行它時,顯示文件夾層次結構,但不是我只想顯示我有完整路徑的文件。

在此先感謝。

回答

1

此代碼是爲我工作

import subprocess 
import os 
import sys 
files = ['/home/test/kelvin/refresh.html','/home/test/kelvin/thread.html'] 
print list(enumerate(files)) 
no=raw_input("enter the file no\n") 
no1 = int(no) 
if sys.platform == 'linux2': 
    subprocess.call(["xdg-open", files[no1]]) 
else 
    os.startfile(files[no1]) 
+0

由於開爾文,XDG-開放解決了我的problem.Initially我想作一個窗口中分別顯示的文件,但因爲我有文件路徑,我可以打開他們用「xdg-open」 – vaibhav1312 2013-02-24 17:38:04

相關問題