Entry box text clear when pressed Tkinter

前端 未结 2 1807
小蘑菇
小蘑菇 2020-12-07 04:43

I\'m not sure whether this has been asked already or not, but I have multiple entry boxes in which contain a default piece of text. I am not trying to set a default piece of

2条回答
  •  离开以前
    2020-12-07 05:28

    The method called by the event binding is given an event object. This object has a reference to the widget that triggered the event. You can use that to clear the widget:

    def removeValue(event):
        event.widget.delete(0, 'end')
    

提交回复
热议问题