I have a problem, can’t understand why the button is positioning at the screen center while it is parented to frame;
frMain = DirectFrame(frameSize=(0.75, 1.25, 0, 1),
frameColor=(0, 0, 0, 1))
b = DirectButton(parent=frMain, text = 'test',
From the code you posted, it seems like you didn’t change the frame position, it is itself in the center of the screen (that’s the default position), so it is expected that a button parented to it, and set to position (0,0,0), will also be at the center of the screen. Changing a frame’s size doesn’t change its position.
Also, Code Snippets is for working pieces of code, this should probably be in Scripting Issues.
I thought it changes pos also, tested, it’s not changing it, is it a bug or I dont understand something
frameSize=(0.75, 1.25, 0, 1)
the frame is not in the center of screen and getPos() returns Point3(0, 0, 0)
Sorry for off, can I move this topic to Scripting Issues or I should recreate it.
The terms you should know about :
- origin : the origin of an object’s transformation (position, rotation, scale, shear)
- center : the center of an object’s geometry
The center is not necessarily it’s origin.
If you need help :
[DirectGUI or nodepath alignment)
I am a bit confused about frame center and origin.
Usually in gui frameworks, things are a bit more simple, I think normally is when I modify the appearance of a property that changes its look, the change should propagate to all other properties that in sum have same effect. Why I would want to change the button’s origin ?? Or I missed something, maybe its usefull when you have complex polygon shaped Frames. Thanks for you help.