How to clear text field part of ttk.Combobox?

12,672

You can clear the selected value of a Combobox by setting its value to an empty string:

ComboBox.set('')
Share:
12,672
Marek
Author by

Marek

Updated on June 14, 2022

Comments

  • Marek
    Marek almost 2 years

    I have a delete function that is supposed to remove the selected item in the Combobox and its associated dictionary value. Then it is supposed to clear the textbox that displays that dictionary value and I would like it to also clear just the text file of the combo box. Is there a way to do that?

    def DeleteEntry():
        if not ComboBox.get() == "" and ComboBox.get() in FriendMap:
            del FriendMap[ComboBox.get()]
            FriendListKeys = FriendMap.keys()
            FriendListKeys.sort()
            ComboBox['values']=FriendListKeys
            FriendListBox.delete(1.0,2.0)
    

    That is what I have thus far but I would like the next line to delete the text field in the Combobox.

  • Daxtrox
    Daxtrox about 2 years
    but it will reappear