Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5 import QtWidgets
- import pandas as pd
- class PandasGUI(QtWidgets.QMainWindow):
- def __init__(self, **kwargs):
- # Property initialization
- self.df_dicts = {}
- self.some_other_property = 5
- super().__init__()
- # This ensures there is always a reference to this widget and it doesn't get garbage collected
- self._reference = self
- for i, (df_name, df_object) in enumerate(kwargs.items()):
- self.df_dicts[df_name] = {}
- self.df_dicts[df_name]['dataframe'] = pd.DataFrame([1,2,3])
- # If you comment out this print statement you get 5 windows
- print(self.df_dicts)
- self.show()
- # Create 5 PandasGUI windows
- app = QtWidgets.QApplication([])
- for i in range(5):
- test_dataframe = pd.DataFrame([1,2,3])
- PandasGUI(test = test_dataframe)
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement