May-08-2021, 04:20 PM
(This post was last modified: May-09-2021, 08:29 AM by Yoriz.
Edit Reason: Title
)
Hi !
I have 2 list box.
i have attached event with both list box.
but after 1st click in both list box, when i click any list box both event triggered.
can some one have any idea
here is event code & declaring of both list box
I have 2 list box.
i have attached event with both list box.
but after 1st click in both list box, when i click any list box both event triggered.
can some one have any idea
here is event code & declaring of both list box
import tkinter as tk
root = tk.Tk()
label = tk.Label(root)
listbox = tk.Listbox(root)
listbox1 = tk.Listbox(root)
label.pack(side="bottom", fill="x")
listbox.pack(side="top", fill="both", expand=True)
listbox1.pack(side="bottom", fill="both", expand=True)
listbox.insert("end", "one", "two", "three", "four", "five")
listbox1.insert("end", "one", "two", "three", "four", "five")
def callback(event):
print("1")
def callback1(event1):
print("2")
listbox.bind("<<ListboxSelect>>", callback)
listbox1.bind("<<ListboxSelect>>", callback1)
root.mainloop()
