Apr-23-2017, 01:11 PM
hello,
I would like to parse a file using a GUI dialog window rather than writing the path directly; so I am using pyside to implement the window. I got the code to browse a file and import it's content as a text string; what I would need is instead to assign the file (or actually its path) I have chosen with the window to an object so that I can use another function to parse the file more properly.
for example, I would need to select the file with the window, then assign the path, let's say,
> /home/gigiux/Documents/myFile.raw
to the variable 'x' and then parse with, for instance,
> parseFun(x, type=raw)
How should I define the function? So far the code I wrote for browsing the file is:
def openFile(self):
self.fileName, self.filterName = QFileDialog.getOpenFileName(self)
self.textEdit.setText(open(self.fileName).read())
thanks
I would like to parse a file using a GUI dialog window rather than writing the path directly; so I am using pyside to implement the window. I got the code to browse a file and import it's content as a text string; what I would need is instead to assign the file (or actually its path) I have chosen with the window to an object so that I can use another function to parse the file more properly.
for example, I would need to select the file with the window, then assign the path, let's say,
> /home/gigiux/Documents/myFile.raw
to the variable 'x' and then parse with, for instance,
> parseFun(x, type=raw)
How should I define the function? So far the code I wrote for browsing the file is:
def openFile(self):
self.fileName, self.filterName = QFileDialog.getOpenFileName(self)
self.textEdit.setText(open(self.fileName).read())
thanks