how can i have the function to enable / disable the entries near the buttons?

后端 未结 3 1394
小鲜肉
小鲜肉 2021-01-27 20:59
import tkinter as tk

class App(tk.Frame):

    def __init__(self):
        super().__init__()
        self.pack()
        self.buttons = []
        self.entries = []

          


        
3条回答
  •  感情败类
    2021-01-27 21:18

    You can set the stateof a widget to 'disabled'

    from tkinter import *
    root = Tk()
    entry = Entry(root, state = 'disabled')
    

    To disable an individual item:

    entry['state'] = 'disabled'
    

    When you push the button, get it's location in the list, than compare that to the entry in the other list. If they match, change its state.

提交回复
热议问题