SHARE
TWEET

Untitled

a guest Aug 17th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from PyQt5 import QtWidgets
  2. import pandas as pd
  3.  
  4. class PandasGUI(QtWidgets.QMainWindow):
  5.     def __init__(self, **kwargs):
  6.  
  7.         # Property initialization
  8.         self.df_dicts = {}
  9.         self.some_other_property = 5
  10.  
  11.         super().__init__()
  12.         # This ensures there is always a reference to this widget and it doesn't get garbage collected
  13.         self._reference = self
  14.  
  15.         for i, (df_name, df_object) in enumerate(kwargs.items()):
  16.             self.df_dicts[df_name] = {}
  17.             self.df_dicts[df_name]['dataframe'] = pd.DataFrame([1,2,3])
  18.  
  19.         # If you comment out this print statement you get 5 windows
  20.         print(self.df_dicts)
  21.  
  22.         self.show()
  23.  
  24. # Create 5 PandasGUI windows
  25. app = QtWidgets.QApplication([])
  26. for i in range(5):
  27.     test_dataframe = pd.DataFrame([1,2,3])
  28.     PandasGUI(test = test_dataframe)
  29.  
  30. app.exec_()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top