I choose the directory with the input files, and it is shown in the right part of tab.
In my case, I want to see the contents of each input file, when I click on it, in the left part of the tab. I use qt.list.itemClicked to choose the file, which should be shown in qt.tableView However, for now, it's just exits with the exit code -1073740791 (0xC0000409)
Have you got solution?
My code:
import sys
import os
from PyQt5 import QtWidgets
import design
import pandas as pd
class interface(QtWidgets.QMainWindow, design.Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.new_analysis.triggered.connect(self.browse_input_folder)
self.listOfInputs.itemClicked.connect(self.input_show)
def browse_input_folder(self):
directory = QtWidgets.QFileDialog.getExistingDirectory(self, 'Выберите папку с исходными данными:')
if directory:
for file_name in os.listdir(directory):
self.listOfInputs.addItem(file_name)
def input_show(self, filename):
input_file = pd.ExcelFile(filename)
table = pd.read_excel(input_file, names=['Время, час', 'S3', 'S1', 'e1', 'e3'], skiprows=1, usecols='A:E')
self.tableShow.clear()
self.tableShow(table)
def main():
app = QtWidgets.QApplication(sys.argv)
window = interface()
window.show()
app.exec_()
if __name__ == '__main__':
main()
User contributions licensed under CC BY-SA 3.0