Tkinter Python GUI troubeshooting

While creating menus in python using Tkinter , aren’t what we write executes in loop. ?

For example, in following part of code, I have created a menu item . I tried to implement the condition that if file exist then 'show rgb ’ menu is enabled. But if I upload the file while the code is executing ,(using GUI ) , then its still disabled.

my_menu.add_cascade(label="Run ",menu=run_menu)
if os.path.isfile(’./dc2.lan’):
run_menu.add_command(label="Display RGB Image ", command=lambda: bands())
else:
run_menu.add_command(label="Display RGB Image ",state=DISABLED)

top.mainloop()

1 Like

I really do not understand your question…
Pls clarify

1 Like