Tag: pyqt

PyQt从excel中填充QTableWidget

即时尝试填充QTableWidget从Excel文件中的一些数据,我想添加行到我的QTable只有当ID是在列表ID,并且我在QTable单元格中没有数据 https://drive.google.com/file/d/0B_PFK3V2Ij4tSko4emplYmNuN1E/view?usp=sharing这里是一个excel文件,它不包含任何格式或公式,只是空的行和列,因为文件是自动生成的 这是我的代码 wb = openpyxl.load_workbook(os.path.join(os.getcwd(), file), read_only=True) ws = wb.active headers = [] for item in ws[4]: headers.append(item.value) headers.pop(0) listID = [] for index in range(self.listWidgetID.count()): listID.append(self.listWidgetID.item(index).text()) data = ws.iter_rows(row_offset=5, column_offset=1) row_increment = 0 self.tableWidgetDATA.setRowCount(1) self.tableWidgetDATA.setColumnCount(len(headers)) self.tableWidgetDATA.setHorizontalHeaderLabels(headers) for x, rows in enumerate(data): if str(rows[0].value) in listID: for y, cell in enumerate(rows): item = QTableWidgetItem(str(cell.value)) […]

PyQt:如何sortingExcel文件(string和数字和datetypes)的QTableView列

这是一个后续问题: PyQt:如何sortingQTableView列(string和数字) 现在我打算对excel文件进​​行相同的sorting 这是我的代码: self.Upload = QtGui.QPushButton() self.Upload.clicked.connect(self.showOpenDialog) self.Table = QtGui.QPushButton() self.table.clicked.connect(self.LoadTable) def showOpenDialog(self): fileName = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '/home') if (".xls" or ".xml" or ".xlsx" or ".xlsm") in fileName: with open(fileName, 'rb') as drate: self.Datas = pd.read_excel(drate, index_col=0) self.Loaded_File.clear() self.Loaded_File.append(fileName) colll = self.Datas.dtypes.index col_names = np.array(colll) def LoadTable(self): tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, self.File_Name) […]

通过复制/粘贴将Python的PyQt QTreeView数据从Python复制到Excel?

有没有一种方法从PyQT的QTreeView – 或QTableView复制使用传统的Ctrl + C / Ctrl + V机制的数据,或者我需要写一个明确的模块,从应用程序数据写入一个CSV文件使用类似xlrd? 我现在看到的效果是Ctrl + C / Ctrl + V只需要1个项目,而不是一堆,即使我编码select模式采取多项select。

Qt和PyQt tablewidget越来越多的行数

我正在学习Python,并试图编写一个程序来帮助我的父亲。 我希望它是excel的样子,现在看起来不错,但我不知道如何使tableWidget中的行数(而不是列)增长,而某些人滚动下来…我可以使用它QtDesigner或我必须在.py文件中写入代码? 任何帮助表示赞赏…对不起,如果我问愚蠢的问题,我真的是一个小白…

用“FILEPICKER”python打开一个数据文件(csv,xls,xlsx,ods等)?

当我们知道文件的名称和types时,我知道如何打开一个数据文件,但是我们如何使用文件select器来select文件? import pyexcel as pe records = pe.get_records(file_name="your_file.xls") for record in records: print("%s is aged at %d" % (record['Name'], record['Age']))

PYQT4不能写入excelwriter

我有一个在pyqt4中创build的gui,它有一个函数来调用一个模块,这个模块应该用pandasexcelwriter写入excel表格。 出于某种原因,它会创build工作表,但不会写入任何内容。 它只是崩溃了我的qui没有任何错误。当我在debugging模式下运行它显然没有任何问题。 这几天我一直在debugging,现在指出了pyqt和excelwriter之间的问题。是否有一个pyqt不喜欢pandasexcelwriter的已知问题? from PyQt4 import QtCore,QtGui import sys from MAIN_GUI import * if __name__=="__main__": app = Qt.Gui.QApplication(sys.argv) class MAIN_GUI(QtGui.QMainWindow): def __init__self: super(MAIN_GUI, self.__init__: self.uiM=Ui_MainWindow self.uiM.setupUi(self) self.connect(self.uiM.updateALL_Button,QtCore.SIGNAL('clicked()'),self.updateALLEXCEL) def updateALLEXCEL(self): import excel_dummy main_gui = MAIN_GUI() main_gui.show() main_gui.raise_() sys.exit(app.exec_()) — excel_dummy.py — import pandas as pd from pandas import ExcelWriter def excelify(): with ExcelWriter('/home/Desktop/Excelified/final.xlsx', engine='xlsxwriter') as […]