auto float formatting

This commit is contained in:
Dave Schuyler 2003-11-11 04:24:47 +00:00
parent 03e8cbc717
commit 55e83fdc5c

View File

@ -2,6 +2,7 @@
from PandaModules import * from PandaModules import *
import types
import OnscreenText import OnscreenText
import DirectUtil import DirectUtil
@ -38,7 +39,11 @@ class OnScreenDebug:
# frame (key roughly equals value): # frame (key roughly equals value):
#isNew = "was" #isNew = "was"
isNew = "~" isNew = "~"
self.onScreenText.appendText("%20s %s %-44s\n"%(k, isNew, v[1])) value = v[1]
if type(value) == types.FloatType:
value = "% 10.4f"%(value,)
# else: other types will be converted to str by the "%s"
self.onScreenText.appendText("%20s %s %-44s\n"%(k, isNew, value))
self.onScreenText.appendText(self.text) self.onScreenText.appendText(self.text)
self.frame += 1 self.frame += 1