tkinter - New to Python, need an event listener equivalent? -


at specific point in script, need set variable co-ordinates clicked on tkinter canvas. don't think canvas.bind work runs specified function when ever clicked on. need sort of equivalent x = raw_input(). appreciated.

here simple snippet saving coordinates canvas widget. using bind want.

import tkinter tk  class application(tk.frame):     def __init__(self, master):         tk.frame.__init__(self, master)         self.canvas = tk.canvas(self.master, width=400, height=400)         self.canvas.bind('<button-1>', self.coordinates)         self.canvas.pack()      def coordinates(self, event):         self.x = (event.x, event.y) # set x (or attr) coordinate tuple  if __name__ == "__main__":     root = tk.tk()     app = application(root)     app.mainloop() 

it sounds need if not, have provide of current code.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -