import subprocess from Tkinter import * from tkFileDialog import askopenfilename def main(): root=Tk() filename = askopenfilename(filetypes=[("allfiles","*"),("jpgfiles","*.jpg")]) p = subprocess.Popen('open file://' + filename, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for line in p.stdout.readlines(): print line, retval = p.wait() main()