I want to make a button that when clicked opens a new window (tk.toplevel), is there a way to make the button only work once, (it only makes one new window when clicked thereafter the the button when clicked does not do anything)
from the below code I can make unlimited amount of top levels by clicking the button BUT I just want it to create one on click.
import tkinter as tk
class run: # pls ignore if there are any syntrax error/spelling because I typed this in stack overflow
def __init___(self, master)
button = tk.button(master, text="btn", self.command=make_new)
button.grid()
def make_new()
new = tk.toplevel(master)
master1 = tk.Tk()
i = Run(master1)
master1.mainloop()
*** I didn't put the original code because it has too many classes/functions to put here
*** this is the other question which I made which has more of the code: How to make a tkinter button open only one Toplevel?