Path_Solving.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Pyslvs-PyQt5 作者: KmolYuan 项目源码 文件源码
def on_importXLSX_clicked(self):
        fileName, _ = QFileDialog.getOpenFileName(self, 'Open file...', self.env, "Microsoft Office Excel(*.xlsx *.xlsm *.xltx *.xltm)")
        if fileName:
            wb = openpyxl.load_workbook(fileName)
            ws = wb.get_sheet_by_name(wb.get_sheet_names()[0])
            data = list()
            i = 1
            while True:
                x = ws.cell(row=i, column=1).value
                y = ws.cell(row=i, column=2).value
                if x==None or y==None:
                    break
                try:
                    data.append((round(float(x), 4), round(float(y), 4)))
                except:
                    dlgbox = QMessageBox(QMessageBox.Warning, "File error", "Wrong format.\nThe datasheet seems to including non-digital cell.", (QMessageBox.Ok), self)
                    if dlgbox.exec_():
                        break
                i += 1
            for e in data:
                self.on_add_clicked(e[0], e[1])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号