1

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.

Recentaly
  • 17
  • 4

1 Answers1

2

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()
Tanay
  • 561
  • 1
  • 3
  • 16