I am writing a program using python w/ tkinter. The GUI is three buttons. Two of them are to be used for inputting a text file, then converting it to a list. I got that part. Next, I need to call the lists (bbb in first function, ddd in second function) to my third function. How would I "summons" them, so to speak, in the code below? (in third function titled button_3) --- Thanks in advance!
Nevermind. If anyone sees in future, you do this by putting <<<Global ddd>>> and <<<Global bbb>>> above InsertedTextFile line in each function. (See below)
def button_1(self):
InsertedTextFile = filedialog.askopenfilename()
with open (InsertedTextFile, "r") as aaa:
aaa = csv.reader(aaa)
bbb = list(aaa)
print(bbb)
def button_2(self):
InsertedTextFile = filedialog.askopenfilename()
with open (InsertedTextFile, "r") as ccc:
ccc = csv.reader(ccc)
ddd = list(ccc)
print(ddd)
def button_3(self):
print (ddd+bbb)Nevermind. If anyone sees in future, you do this by putting <<<Global ddd>>> and <<<Global bbb>>> above InsertedTextFile line in each function. (See below)
def button_1(self):
Global bbb
InsertedTextFile = filedialog.askopenfilename()
with open (InsertedTextFile, "r") as aaa:
aaa = csv.reader(aaa)
bbb = list(aaa)
print(bbb)
def button_2(self):
Global ddd
InsertedTextFile = filedialog.askopenfilename()
with open (InsertedTextFile, "r") as ccc:
ccc = csv.reader(ccc)
ddd = list(ccc)
print(ddd)
