Jump to content

Modificar um widget por outra janela


Recommended Posts

Olá, no código abaixo gostaria de saber como faço para alterar o status do botão BT1 da janela "intro" para "desabilitado" clicando no botão BT2 localizado na janela sec_win. Segue abaixo o código..

____________________________________

import tkinter as tk

class sec_win(tk.Toplevel):
    def __init__(self, parent):
        super().__init__()

        self.geometry("200x200")
        self.title("SecWin")

        BT2 = tk.Button(self, text="ChangeBT")
        BT2.place(x=20,y=40)

class intro(tk.Tk):
    def __init__(self):
        super().__init__()

        self.geometry("150x150")
        self.title("Intro Window")

        BT1 = tk.Button(self, text="Open Window", command=self.open_win)
        BT1.place(x=20,y=20)

    def open_win(self):
        win2 = sec_win(self)
        win2.grab_set()

if __name__ == "__main__":
    win = intro()
    win.mainloop()

____________________________________

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 65 Guests (See full list)

    • There are no registered users currently online


×
×
  • Create New...