DirectGui positioning Button in Frame

Hi all,
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))
#        frMain.reparentTo(aspect2d)
        
        b = DirectButton(parent=frMain, text = 'test',
                         text_align=TextProperties.ACenter, 
                         command=setText,
                         scale=0.1,
                         pos=(0,0,0),
                         extraArgs=[frMain])

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.

from manual:
frameSize (Left,Right,Bottom,Top)

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 :

  1. origin : the origin of an object’s transformation (position, rotation, scale, shear)
  2. 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.