'How to make tkinter listbox item inactive

My problem is what i need to make tkinter listbox item inactive, i have listbox with this code: Listbox config:

frame_dirs = LabelFrame(tab_files, text='Папки')
    frame_dirs.grid(column=0, row=1, padx=10, sticky="N")
    self.dirs_listbox = Listbox(frame_dirs, width=60, height=20, selectmode=SINGLE)
    self.dirs_listbox.pack(pady=10, padx=10)
    self.dirs_listbox.bind('<Double-1>', self.change_state)
    self.dirs_listbox.focus_set()

Listbox insertion:

        dirs = self.get_dir_list()
    for dir in dirs:
        self.dirs_listbox.insert(dirs.index(dir), dir)
    self.dirs_listbox.select_set(0)

get_dir_list function:

def get_dir_list(self):
    all_files = os.listdir(self.source_folder)
    dirs = []
    for file in all_files:
        file = os.path.join(self.source_folder, file)
        if os.path.isdir(file):
            dirs.append(file)
    return dirs

And i have the second listbox with files "Ч*.txt":

frame_files = LabelFrame(tab_files, text='Файлы')
    frame_files.grid(column=1, row=1, padx=10, sticky="N")
    self.files_listbox = Listbox(frame_files, width=76, height=20, selectmode=EXTENDED)
    self.files_listbox.pack(pady=10, padx=10)

def get_file_list(self, dir_list):
    files = []
    for dir in dir_list:
        for file in os.listdir(dir):
            if file.startswith(("ч", "Ч")) and file.endswith(".txt"): 
             file = os.path.join(dir, file)                
             files.append(file)       
    return files

I need to make item from dirs listbox inactive for get_file_list function with double-click, but i don't now how to do it. I was tried this:

 self.dirs_listbox.bind('<Double-1>', self.change_state)

 def change_state(self, event):
    for i in self.dirs_listbox.curselection():
     print(i)
     print(self.dirs_listbox.get(i))
     self.dirs_listbox.itemconfig(i, {'fg':'red'})

If i can get the color of listbox item, i can create something like this:

if item_color != red:
  insert item to listbox

but i don't now how to do this



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source