Matthew Polack wrote:

> I'm also trying to solve the rounding issue...but can't work out the
> syntax using the example provided...have tried this but I get an error...
> 
> _tkinter.TclError: unknown option "-text %.2f"
> 
> .I'm sure it is a simple syntax issue...but I don't know what it is.
> 
> def viewPercent():
>      percentCalc = score/total*100
>      percentViewLab["text %.2f"] % percentCalc

I'm sure you can resolve that one yourself. You have

obj[key] = float_value

Now you want to format the float value as a string showing a decimal number.
So all you need to change is the righthand side. If it helps write it in two 
lines:

some_string = ... expression involving float_value ...
obj[key] = some_string

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to