How can i select a file with python?
Question: [enter image description here](http://i.stack.imgur.com/mMIsq.png)

I can do like this on Java, but i can't do on Python

    
    
    StringSelection ss = new StringSelection("C:\\Users\\Mert\\Desktop\\hello.png");
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
    Robot robot = new Robot();
    robot.keyPress(KeyEvent.VK_ENTER);
    robot.keyRelease(KeyEvent.VK_ENTER);
    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_V);
    robot.keyRelease(KeyEvent.VK_V);
    robot.keyRelease(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_ENTER);
    robot.keyRelease(KeyEvent.VK_ENTER);
    


Answer: You can open a file GUI similar to Java using Python's `tkinter`:

    
    
    from Tkinter import Tk
    from tkFileDialog import askopenfilename
    
    Tk().withdraw()
    filename = askopenfilename()
    print(filename)
    

And the Python3 equivalent:

    
    
    from tkinter.filedialog import askopenfilename
    filename = askopenfilename()
    

