Created
July 17, 2016 10:35
-
-
Save mukkachaitanya/dd8a42c63b6f93bc6a1ba3052c9e4440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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