TypeError
Steve Holden
sholden at holdenweb.com
Thu Oct 26 14:12:21 EDT 2000
joonas wrote:
>
> I used the "print type(first)" method and it printed
>
> "<type 'Button'>"
>
> but when i wrote used "print first" it gave me
>
> "100"
>
> So. How can i make first substractable.
>
> Joonas.
If you can tell me how to subtract three from a banana, I'll tell you
how to subtract one hundred from a button!
The confusion seens to be that you want to get some numeric property
of the button (probably its caption) and subtract that from it. A button
is a complex graphical object, with many properties.
When you see "100" as the value of the button in printing it, the print
statement is actually asking the Python system to produce a printable
representation of itself.
Look in the Tkinter documentation at the properties of buttons, and
you'll probably find what you need is something like
sppedgear.text = str(int(first.text) - int(second.text))
Hope this helps.
regards
Steve
--
Helping people meet their information needs with training and technology.
703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/
More information about the Python-list
mailing list