I want to check what option the dropdown menu is set to. The program check the day and the dropdown menu option and sets a string accordingly. Right now the code looks like this. Is there a way I can check the value of the dropdown menu?
class FrameStart1(tkinter.Frame):
image = PhotoImage(file='C:/Users/plarkin2020334/Pictures/DQ_Logocp.png')
def __init__(self, parent, *args, **kwargs):
tkinter.Frame.__init__(self, parent, *args, **kwargs)
Label(self, image=self.image).place(relx=0, rely=0, anchor=NW)
Label(self, text="Enter any additional Instructiuons for the day:", background="#3f49e5").place(relx=.0, rely=.45)
self.info = tkinter.StringVar()
self.entry = tkinter.Entry(self, textvariable=self.info).place(relx=.0, rely=.51)
Button(self, text="Add to Todays List", command=self.add_list).place(relx=.24, rely=.51)
tkvar = StringVar()
self.choices = {'Open', 'Day', 'Close'}
self.opt = OptionMenu(self, tkvar, *self.choices, ).place(relx=.0008 , rely=.572)
def add_list(self):
global Day
if date.today().weekday() == 2 and self.opt == 'Open':
Day = "List_Wednesday_Morn.txt"
with open(Day, "r+") as file:
for line in file:
if not line.strip():
continue
else:
file.write("\n" + self.info.get())