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 38 39 40 41 42
| from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(252, 600)
self.import_btn = QtWidgets.QCommandLinkButton(Form)
self.import_btn.setGeometry(QtCore.QRect(10, 60, 231, 41))
self.import_btn.setLayoutDirection(QtCore.Qt.LeftToRight)
self.import_btn.setStyleSheet("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("Import_Icon_48.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.import_btn.setIcon(icon1)
self.import_btn.setObjectName("import_btn")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
#Action du bouton import
self.import_btn.clicked.connect(self.SingleBrowse)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.import_btn.setText(_translate("Form", "IMPORT"))
# Fonction pour download STL
def SingleBrowse(self):
filePath = QFileDialog.getOpenFileName(self,
'Single File',
"C://",
'*.stl')
fileHandle = open(filePath, 'r')
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_()) |
Partager