2
私はちょうどthinterのリストボックスからどのように選択を外すことができるのだろうかと思っています。リストボックス内の何かをクリックすると、強調表示されて下線が引かれますが、画面をクリックするとリストボックスの選択が強調表示されたままになります。ボタンをクリックしても選択範囲には下線が残ります。例:以下のサンプルコードでは、リストボックスの中から1つをクリックしてからクリックすることはできません。Tkinterのリストボックスからの選択解除
from tkinter import *
def Add():
listbox.insert(END, textVar.get())
root = Tk()
textVar = StringVar()
entry = Entry(root, textvariable = textVar)
add = Button(root, text="add", command = Add)
frame = Frame(root, height=100, width=100, bg="blue")
listbox = Listbox(root, height=5)
add.grid(row=0, column=0, sticky=W)
entry.grid(row=0, column=1, sticky=E)
listbox.grid(row=1, column=0)
frame.grid(row=1, column=1)
root.mainloop()