I´m trying to execute an external script (named EC.py) by pressing a button on my GUI (named BEN.py) and I want it to be inserted on a list (list1) in my GUI.
My external script (EC.py) is like this:
import scipy
import numpy as np
from scipy import misc
from scipy import ndimage
I = scipy.misc.imread('lena.jpg').astype(int)
J = (I/10)*10
K = J + 10
Print K
and my GUI (BEN.py) code is:
import os
import Tkinter as tk
import ttk
def Execute():
EC.K
list1.insert(END, K)
my button widget:
mybutton = Button(myGUI, text=”Execute Code”, command = Execute).pack()
my output list:
list1 = Listbox(myGUI, height=20, width=80)
Everything goes reasonably fine, except that just by running my GUI code it already reads the EC.py script, before I press the button. What I want is to get this script to run only when I press the button.