Is everything okay with you? So, I'm doing a screenshot program, its function would just be a test consisting of: Open a screen (called by a button) and close the one that was open. I do not know how to do this, I have tried to use repetition loops, but without success ... Code: from tkinter import *
def bt_click():
janela2 = Tk()
teste2 = janela2
janela2.title("Teste2")
janela2.geometry("200x200+300+300")
janela = Tk()
bt1 = Button(janela, text = "Click me", command = bt_click)
bt1.place(x = 50, y = 100)
janela["bg"] = "green"
janela.geometry("300x300+300+300")
janela.mainloop()
My idea was: Put the whole window in a while loop, and do so:
teste = 1
while teste == 1:
janela() ...
and when I called the other window (window 2), at the end of the function, cause the test variable to become 2 or any other number, but I think since the test variable is within the function of window2, it becomes local .. How to proceed? Hugs