could someone help me with some part of a GUI? There is a submenu, Load, upon clicking, a fileselector dialog should pop up. The file has three variables, (Name, Subject, Mark) a row, separated by commas. The names and subjects are stored in Label typed tkinter objects, marks are displayed in Entries. At the bottom, a button should be placed . If clicked, it should disable/enable all the Entry typed objects in the gui. I am done with this so far:
Thank you!
from tkinter import * from tkinter import messagebox from tkinter import filedialog from tkinter import ttk def loadthefile(): filename = filedialog.askopenfilename() with open(filename) as f: rownum = sum(1 for _ in f) def my_callback(): if button1["text"] == "Unlock": button1["text"] = "Lock" else: button1["text"] = "Unlock" button1 = Button(master, text= "Unlock", command=my_callback) button1.grid(row=rownum + 1, columnspan=3, sticky=W+E+S+N) master = Tk() menu_bar = Menu(master) file_menu = Menu(menu_bar, tearoff=0) file_menu.add_command(label="Load", command=loadthefile) file_menu.add_command(label="Save") file_menu.add_separator() file_menu.add_command(label="Quit", command=master.quit) menu_bar.add_cascade(label="File", menu=file_menu) master.config(menu=menu_bar) master.mainloop()
Thank you!