-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.py
executable file
·37 lines (30 loc) · 1.07 KB
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python3
from convert import convert
import sys
from PyQt5.QtWidgets import QAction, QApplication, QPushButton, QWidget, QMainWindow, QFileDialog,QInputDialog, QLineEdit, QFileDialog
class GUI(QMainWindow):
def __init__(self):
super().__init__()
self.title = 'open file'
self.left = 10
self.top = 10
self.width = 640
self.height = 480
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.openFileNameDialog()
self.show()
def openFileNameDialog(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","All Files (*);;Python Files (*.py)", options=options)
if fileName:
print(fileName)
pass
if __name__ == '__main__':
app = QApplication(sys.argv)
gui = GUI()
gui.show()
sys.exit(app.exec_())