sorry if this a dumb question... but I'm new to learning Python and this is a homework question...
So I want to stop people from reopening an already loaded file using tkinter - and have an error dialog box pop up when they try to open the file.
So far I've got this:
from tkinter import filedialog
from tkinter import messagebox
def open_file(self):
openfiles=[]
filename = filedialog.askopenfilename(filetypes=[("allfiles","*.txt")])
if filename not in openfiles:
openfiles.append(filename)
self._filename = filename
functiontoloadfile(filename)
else:
messagebox.showerror(filename + "is already open")