manipulating data 
Author Message
 manipulating data

Need some help;

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.  I would like to put it into the variable,
multiply it b = b * .0875  (example)
and then eventually cPickle it.

How do I put it into the variable??

Thanks

Sent via Deja.com
http://www.*-*-*.com/



Fri, 04 Jul 2003 12:18:25 GMT  
 manipulating data

Quote:

> 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.

Quote:
> 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



Fri, 04 Jul 2003 14:31:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Manipulating data paths

2. Manipulating Data Files Under SM/V Mac

3. Using C to manipulate data aquired from the serial port.

4. Tkinter: manipulating data in 'entry' widgets.

5. Manipulating CLARION 2.1 data with MICROSOFT ACCESS 2.0

6. Manipulating externally created binary data with tcl.

7. Manipulating binary data

8. Manipulating Excel Spreadsheets in Dolphin

9. Manipulating character strings

10. Manipulating string elements within arrays

11. manipulating string

 

 
Powered by phpBB® Forum Software