python - Updating a Tkinter canvas with a list created inside a function -


i'm developing gui tkinter , have been successful until now. want update canvas list created in function (inside class). have following:

class gc_data_tk(tkinter.tk):     def __init__(self,parent):         tkinter.tk.__init__(self,parent)         self.parent = parent         self.initialize()         self.grid()      def initialize(self):         self.canvas = tkinter.canvas(self, width = 600, height = 400, bg = 'white').grid(column = 5, row = 1)  

i want use self.result list created in following:

def result(self):         self.result = []         filepath = self.folder         filepath1 = self.folder +"\*.csv"         print filepath         comps = float(self.no_comps.get())         no_comps = comps +2          files = glob.glob(filepath1)         dataframes = [pd.dataframe.from_csv(f, index_col=none, header=none) f in files]         new_dfb = pd.dataframe()          i, df in enumerate(dataframes):             colname = 'run {}'.format(i+1)             selected_data = df[3].ix[0:no_comps]              new_dfb[colname] = selected_data         self.result.append(new_dfb)         folder = filepath + "\summary.csv"         new_dfb.to_csv(folder)          print self.result 

to print canvas. possible though result stored inside function?

the function "result(self)" called following:

self.button2 = tkinter.button(self, text = "run", font = ("helvetica, 12"), command = self.combine_funcs(self.tx0_to_csv,self.csv_to_csv,self.result)).grid(column = 0, row = 7, columnspan = 1, rowspan  =1, padx = 5, pady=5) 

the current result outputs cmd as:

enter image description here


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -