DirectGUI widget transforms question

More of a DirectGUI question in general.
I am using the example for printing out the positions of the nodes with the following code

def PrintWidgetTransformsF(self):
		for child in self.mGUI.getChildren():
			print child, "  position = ", child.getPos()
			print child, "  scale = ", child.getScale()

I am getting:

render2d/aspect2d/GUI/DirectButton-pg0   position =  Point3(-1.0625, 0, 0.760417)
render2d/aspect2d/GUI/DirectButton-pg0   scale =  VBase3(0.5, 0.5, 0.5)
render2d/aspect2d/GUI/DirectButton-pg1   position =  Point3(-0.549479, 0, 0.757813)
render2d/aspect2d/GUI/DirectButton-pg1   scale =  VBase3(0.5, 0.5, 0.5)
render2d/aspect2d/GUI/DirectButton-pg2   position =  Point3(-1.1, 0, 0.95)
render2d/aspect2d/GUI/DirectButton-pg2   scale =  VBase3(0.05, 0.05, 0.05)

my question is, can I rename the node so I can get a more verbose printout instead of -pg0, -pg1 etc?

Also, this related thing just cropped up, When I try to scale a button non-uniformly I get this

self.gunFrameGUI = DirectButton(image = Plates256x192.find('**/Plate_Gun'), relief = None, scale = (0.5,0.0,0.375))

:linmath(warning): Tried to invert singular LMatrix3.

The image shows up just fine, but I get that warning in a loop

Nevermind I realised what I did wrong, I tried to scale the Y axis by 0. :facepalm:

Okay problem number 3, Switching from a 4:3 aspect ratio to a 16:9 messes up the positional coordinates. in a 4:3, -1.06771 will set the UI element nearly all the way to the left of the screen, but in a 16:9 it is about 3 inches from the left.

I know how I can solve it on my side, but it involves setting up multiple coordinate values.

You could place your GUI element in render2d instead of aspect2d and apply the aspect correction manually. render2d ought to be more consistent across different aspect ratios. To apply the aspect correction:


Or you can smartly use base.a2dBottomLeft and a2dTopRight and the others to position a widget relative to a corner or border of the screen.