Tkinter question

Nicholas.Vaidyanathan at aps.com Nicholas.Vaidyanathan at aps.com
Tue Jun 14 17:22:40 EDT 2005


I'm sure there must be a way to do this, but I can't figure it out for
the life of me... I'm writing a program where I would like to use a
button's text field as part of an if statement. I set up my button like
this:

 i = [ "7", "8","9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0",
".", "=", "+"]
 t = 0   #iterator through the sequence

for x in range(4):
            for y in range(4):
                self.buttonx = Button(self, text = "%s" %i[t] ,
width=10, command = self.pressed)
                self.buttonx.grid( row=x+1, column = y, sticky = W+E+S)
                t+=1

What I would like to do is is check which buttons' text values are
digits, and if the text is, I would like to append the number to a
label. But:

if(self.buttonx.title.isdigit):

Doesn't work. How do I access the button's text field?

Thanks!

"MMS <apsc.com>" made the following annotations.
------------------------------------------------------------------------------
--- NOTICE ---
This message is for the designated recipient only and may contain confidential, privileged or proprietary information.  If you have received it in error, please notify the sender immediately and delete the original and any copy or printout.  Unintended recipients are prohibited from making any other use of this e-mail.  Although we have taken reasonable precautions to ensure no viruses are present in this e-mail, we accept no liability for any loss or damage arising from the use of this e-mail or attachments, or for any delay or errors or omissions in the contents which result from e-mail transmission.

==============================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050614/6ddbc184/attachment.html>


More information about the Python-list mailing list