List xyz/hpr out to label on screen

  • takes deep breath *

I’m really new to programming and Python, but I’m having a blast. I LOVE how many code samples and people are sharing with each other here; it’s a very welcoming place. In that spirit, I hope my question doesn’t come off rude. I’m just ignorant of how to do so many things.

I’m wanting to see some debug output as I move models around in a game. So I put a DirectLabel on screen to output my main object’s xyz/hpr, hoping to start creating something like the debug screen in the popular game Minecraft .

However, my attempt to fetch just the X coord with

try:
     self.DebugLabelXYZ['text'] = self.cruiser.getX()
     self.DebugLabelXYZ.setText()
except:
     print("Couldn't output coords")

ends up listing

<built-in method getX of libpanda.NodePath object at 0x01D3FFE0>

How can I have my label update with the coords of the main object I’m moving?

It’s supposed to work. Are you sure you didn’t forget the () at the end of getX?

self.debugLabelXYZ['text'] = "X: %f  Y: %f  Z: %f" % (obj.getX(), obj.getY(), obj.getZ())

Ah, perfect! Thank you. That works smashingly well.