Updating a Tkinter canvas with a list created inside a function
<p>I'm developing a GUI with Tkinter and have been successful up until now. I want to update a canvas with a list created in a function (inside a class). I have the following: </p>

<pre><code>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) 
</code></pre>

<p>I want to use the self.Result list created in the following: </p>

<pre><code>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) for f in files]
        new_dfb = pd.DataFrame()

        for 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
</code></pre>

<p>to print to the canvas. Is it possible to do this even though the result is stored inside a function?</p>

<p>The function "result(self)" is called with the following: </p>

<pre><code>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)
</code></pre>

<p>The current Result outputs to cmd as: </p>

<p><a href="https://i.stack.imgur.com/bEbOA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bEbOA.png" alt="enter image description here"></a></p>