以下功能均由单独的单击信号激活QPushButton
。我想让用户可以选择一个.pdf
文件,进行一些程序特定的编辑并将其保存到用户定义的位置。
我怎样才能将路径.pdf
传递给另一个函数?
def select(self):
dir = "."
fileObjOpen = QFileDialog.getOpenFileName(self, "Select a .pdf file", dir=dir, filter="PDF Files (*.pdf)")
fileObjOpenName = fileObjOpen[0]
if (len(fileObjOpenName) > 1):
path_to_pdf = fileObjOpenName
def save(self):
dir = "."
fileObjSave = QFileDialog.getSaveFileName(self, "Where to save the new pdf file", dir=dir, filter="PDF Files (*.pdf)")
fileNameSave = fileObjSave[0]
if (len(fileNameSave) > 1):
path_to_pdf = path_to_pdf