Skip to content

Instantly share code, notes, and snippets.

@mukkachaitanya
Created July 17, 2016 10:35
Show Gist options
  • Save mukkachaitanya/dd8a42c63b6f93bc6a1ba3052c9e4440 to your computer and use it in GitHub Desktop.
Save mukkachaitanya/dd8a42c63b6f93bc6a1ba3052c9e4440 to your computer and use it in GitHub Desktop.
import Tkinter as tk
class SampleApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
lb = tk.Listbox(self)
lb.insert("end", "one")
lb.insert("end", "two")
lb.insert("end", "three")
lb.bind("<Double-Button-1>", self.OnDouble)
lb.pack(side="top", fill="both", expand=True)
def OnDouble(self, event):
widget = event.widget
selection=widget.curselection()
value = widget.get(selection[0])
print "selection:", selection, ": '%s'" % value
if __name__ == "__main__":
app = SampleApp()
app.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment