Hi, I am trying to write a simple Tkinter code in Python in order to demonstrate select/copy/paste/cut functionalities using keyboard keys and menu options. I tried looking up online, but I am finding examples of these in which they create an event and then it is used: eg.:
import Tkinter def make_menu(w): global the_menu the_menu = Tkinter.Menu(w, tearoff=0) # the_menu.add_command(label="Select") the_menu.add_command(label="Cut") the_menu.add_command(label="Copy") the_menu.add_command(label="Paste") def show_menu(e): w = e.widget # the_menu.entryconfigure("Select",command=lambda: w.event_generate("<<Select>>")) the_menu.entryconfigure("Cut",command=lambda: w.event_generate("<<Cut>>")) the_menu.entryconfigure("Copy",command=lambda: w.event_generate("<<Copy>>")) the_menu.entryconfigure("Paste",command=lambda: w.event_generate("<<Paste>>")) the_menu.tk.call("tk_popup", the_menu, e.x_root, e.y_root) root = Tkinter.Tk() make_menu(root) e1 = Tkinter.Entry(); e1.pack() e2 = Tkinter.Entry(); e2.pack() e1.bind_class("Entry", "<Double-1><ButtonRelease-1>", show_menu) root.mainloop() I was wondering if someone could please tell me a simplified different way of doing this, that would be great. Thank you. Pooja _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor