Close and open windows with tkinter -
i have main window, , button inside of one, open window, closed button. how possible once latter closed can not reopen it? attach code of 2 programs.
first program
from tkinter import * def funzbottocli():import nuovaprova root = tk() root.state('zoomed') root.title("gestionale") bottoncli = button(root, text=" apertura altra finestra ", fg=('red'), font=('arial',10,'bold'), relief='raised', command=funzbottocli).place(x=20, y=20) root.mainloop() #second program tkinter import * def funzbottocli():fine_cli_ins.destroy() fine_cli_ins = tk() fine_cli_ins.title("inserimento anagrafica clienti") fine_cli_ins.geometry('640x480+400+150') form1 = frame(fine_cli_ins, bg='red',width=640, height=50, relief='raised', border=3).pack() label1 = label(fine_cli_ins, text=(" inserimento clienti "), fg=('red'), bg=('gray'), font=('arial',16,'bold'), relief='raised').place(x=200, y=10) bottoncli = button(fine_cli_ins, text=" chiusura finestra ", fg=('red'), font=('arial',10,'bold'), relief='raised', command=funzbottocli).place(x=260, y=400) fine_cli_ins.mainloop()
if want open , close multiple windows. proper way create single instance of tk
, 1 or more instances of toplevel
. program should exit when instance of tk
destroyed.
Comments
Post a Comment