title: Select files using file browser and store the path in a python script
body: <p>I want to use a file browser to load a few .csv(let's call them csv1) files and run them in my python script. As a result it will copy some columns from csv1 and generate a new .csv file (csv2). I have written the codes for the file browser, and also the script to generate the csv2 file. However, I cannot find a way to use the file browser to select the csv1 and then input it in my script to create the csv2 file. </p>
  
  <p>If anyone knows the solution, please help to comment. Appreciated a lot!!</p>
  
  <p>The following is my codes so far: </p>
  
  <pre><code>from PyQt4 import QtGui
  import os, sys
  import subprocess
  
  class Widget(QtGui.QWidget):
  
      def __init__(self):
          super(Widget, self).__init__()
          self.initUI()
  
  
      def initUI(self):
          self.setGeometry(600, 300, 400, 200)
          self.setWindowTitle('Multiple Browse')     
  
          btn = QtGui.QPushButton('Browse', self)
          btn.resize(btn.sizeHint())
          btn.clicked.connect(self.SingleBrowse)
          btn.move(150, 100)     
  
          self.show()
  
      def SingleBrowse(self):
          filePaths = QtGui.QFileDialog.getOpenFileNames(self, 
                                                     'Multiple File',
                                                     "Desktop",
                                                    '*.csv')
  
  def main():
      app = QtGui.QApplication(sys.argv)
      w = Widget()
      app.exec_()
  
  
  if __name__ == '__main__':
      main()
  
  
  ## Below codes are initially from a separate script, but I just combine them 
  ## together in one. Because I think maybe I could call the class function 
  ## "Wideget" somewhere below for using the file browser to select the files?
  
  import pandas as pd
  from pandas import DataFrame
  
  df1 = pd.read_csv('csv0.csv') 
  df2 = pd.read_csv('csv1.csv')
  
  df3 = df1.loc[:, ['a_column', 'b_column']] 
  
  df3[""] = "" 
  
  df4 = df2.loc[:, ['c_column','d_column' , 'e_column']]
  
  new = pd.concat([df3, df4], axis=1)
  
  new.index = new.index + 1
  
  new.to_csv('csv2.csv')
  </code></pre>