TKinter, buttonwidget response problem(1) and all btns the same size(2)!

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Apr 5 05:31:57 EDT 2008


En Sat, 05 Apr 2008 03:02:02 -0300, <skanemupp at yahoo.se> escribió:

> am i not doing that then? did u look at the code? where do i add the
> bind if this:
> btnDisplay = Button(self, text="1", command=self.Display)
>         btnDisplay.grid(row=3, column=0, padx=5, pady=5)
>
> is not enough?

Yes, I looked at the code, andn I don't see the word "bind" anywhere, do  
you?

> def Display(self, event_obj):
>         button = event_obj.widget
>         text = button.cget("text")
>
>         if text=="1":
>             print 1

This Display method is OK for *bind* but you're using *command*. Read the  
previous response and in particular the Tkinter book - from the same guy  
who wrote the library.

-- 
Gabriel Genellina




More information about the Python-list mailing list