manipulating data
Fredrik Lundh
fredrik at effbot.org
Mon Jan 15 01:31:04 EST 2001
ibrewale_2000 at yahoo.com wrote:
> I have a Pmw/Tkinter program I am trying to write (just learning), in a
> text entry box I can retrieve numbers entered into it and print it like
> this...
>
> print self.amount.get()
>
> But I want to assign the number I retrieve with get, into a variable,
> like:
>
> b = self.amount.get()
>
> but this doesnt work.
"doesn't work" as in "TypeError: can't multiply sequence
with non-int"?
If so, Python's trying to say that you're mixing data types.
> How do I put it into the variable??
assuming "self.amount" is an Entry widget (or something
compatible), try:
b = float(self.amount.get())
b = b * 0.0875
...
Cheers /F
More information about the Python-list
mailing list