Home > other >  Python how to set up double click delete selected item in the Listbox
Python how to set up double click delete selected item in the Listbox

Time:10-23

How to set up in the Listbox double-tap or the Delete key on the keyboard to Delete the selected one

CodePudding user response:

First of all, define a function:
Def delete_the_line (* args) :
ListBox_1. Delete (first=listBox_1 curselection (), the last=None) # delete listbox choose the contents of the
Then you set the listbox control binding a double-click the mouse events:
ListBox_1. Bind (' & lt; Double - Button - 1 & gt; ', delete_the_line) # after this command refers to double click the mouse, called function delete_the_line, then execute the delete command
  • Related