How to make a health bar

Does anyone know how to make a simple health bar that will appear on the top of the screen? I want it to also slowly go down every 5 min or so to simulate being hungry. I saw some people used directgui but I have no idea.

Thanks!

More or less like this:

from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectGui import  DirectWaitBar

class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)

        self.bar = DirectWaitBar(pos=(0,0,0.7))
        self.bar['range'] = 100
        self.bar['value'] = 100

        taskMgr.doMethodLater(0.1, self.life, "life-")

    def life(self, task):
        if (self.bar['value'] >= 0):
            self.bar['value'] -= 1
        else:
            print ("die")
            return task.done
            
        return task.again

app = MyApp()
app.run()

Set the interval to 5 minutes:

taskMgr.doMethodLater(300, self.life, "life-")

Also change the amount of life that goes away:

self.bar['value'] -= 1

ok thanks let me try

So the health bar and it going down all works, but for some reason I can’t see my environment or anything at all. It’s just gray, how do I fix this? Oh never mind fixed it, thanks again!