Tkinter: how; newbie

Gigs_ gigs at hi.t-com.hr
Wed Feb 14 07:32:39 EST 2007


jim-on-linux wrote:
> On Tuesday 13 February 2007 18:02, Gigs_ wrote:
>> can someone explain me this code?
>>
>> from Tkinter import *
>>
>> root = Tk()
>>
>> def callback(event):
>>      print "clicked at", event.x, event.y
>>
>> frame = Frame(root, width=100, height=100)
>> frame.bind("<Button-1>", callback)
>> frame.pack()
>>
>> root.mainloop()
>>
> if you live on longititude 32, wrere is that? 
> If you live on latitude 40 and longitiude 32 I can 
> find that location. 
> 
>  Your mouse is pointing to x, and y, which is 
> simply a location on the screen.
> 
I know that, Matimus has explained what I didn't get
but thx anyway
> 
>> well, my problem is at frame.bind(",Button-1>",
>> callback) callback function prints event.x and
>> event.y. How the callback function get this two
>> number when it has only one argument (event)
>> Why its not: def callback(x, y): print x, y
>>
>> Im new to gui programming
>>
>> Sorry for bad eng!
>>
>> Thanks for replay!



More information about the Python-list mailing list