I have this code:
BUTTON_INDENT = -1
class TIME(Text):
def __init__(self):
super().__init__(
text=time.strftime("%H:%M"),
position=(0,0,BUTTON_INDENT),
)
How do I make it so the text inside changes?
I have tried this before too:
BUTTON_INDENT = -1
class TIME(Text):
def __init__(self):
super().__init__(
text=time.strftime("%H:%M"),
position=(0,0,BUTTON_INDENT)
)
def update(self):
self.text = time.strftime("%H:%M")
That doesn't seem to make the text change either.
Anyhow, the update function doesn't work in Text
class, here is the full updated code :
from ursina import *
app = Ursina()
BUTTON_INDENT = -1
class TIME(Text):
def __init__(self):
super().__init__()
self.text=time.strftime("%H:%M:%S")
self.position=(0,0,BUTTON_INDENT)
t = TIME()
def update():
t.text = time.strftime("%H:%M:%S")
app.run()