I have to load very huge pandas dataframe stored in a local HDD when PyQt GUI is loaded.
The problem is, GUI window hangs until loading huge file is finished.
The below is my sample code.
I think my hanging problem can be solved by using thread and progressbar window.
But, most thread examples I found are using global functions and variables.
In my situation, self.pkl.file should have loaded data. So I should find proper way to toss instance to thread class/function.
I hope you to introduce several sample code or guideline for my situation.
Thank you in advance.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui
import pandas as pd
class Pkl():
def __init__(self):
self.file = pd.read_pickle('file.dat')
class MyWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MyWindow, self).__init__(parent)
self.setWindowTitle('MyWindow')
self.show()
self.pkl = Pkl()
def close_application(self):
self.close()
def main():
app = QtGui.QApplication(sys.argv)
GUI = MyWindow()
'''
w = QtGui.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
'''
sys.exit(app.exec_())
if __name__ == '__main__':
main()