from tkinter import Tk, Entry, Checkbutton, mainloop
class Example(Tk):
def __init__(self):
super().__init__()
self.input_field_1 = Entry(self)
self.input_field_1.grid(row=0, column=0)
self.check_button_1 = Checkbutton(self)
self.check_button_1.grid(row=0, column=1)
self.input_field_2 = Entry(self)
self.input_field_2.grid(row=1, column=0)
self.check_button_2 = Checkbutton(self, command=self.disable_or_normal_input_field_2)
self.check_button_2.grid(row=1, column=1)
def disable_or_normal_input_field_2(self):
if self.input_field_2['state'] == 'normal':
self.input_field_2.configure(state="disable")
else:
self.input_field_2.configure(state="normal")
print("Поле ввода 2 статус:", self.input_field_2['state'])
def main():
example = Example()
example.mainloop()
if __name__ == '__main__':
main()