How to get the parameters of the Transformation matrix of the component

I’m sorry, I’ve been studying python applications these days, so I have many questions to ask, please forgive me.

I want to get the parameters of the Transformation matrix of the component, I want to use for calculations between parameters. I didn’t find a way to get these parameters.

layer = Glyphs.font.selectedLayers[0] # current layer

component = layer.components[3] # first component

# select component
layer.components[3].selected = True

# print selection state
print layer.components[3].selected,

print component.transform,

**scaleX = component.transform.scale.x,** # AttributeError: 'tuple' object has no attribute 'scale'
**skewX = component.transform.skew.x,** 
**skewY = component.transform.skew.y,**
**scaleY = component.transform.scale.y,**
**positionX = component.transform.position.x,** # This is wrong
**positionY = component.transform.position.y,**  # What can I do?

component.transform = ((
                        scaleX / 1.096, # x scale factor
                        skewX, # x skew factor
                        skewY, # y skew factor
                        scaleY / 1.725, # y scale factor
                        positionX - scalex * 6, # x position
                        positionY - scaley * 9 # y position
                        ))

A GSComponent has a transform attribute. So, to get the transform matrix of the first component:

print Layer.components[0].transform

See this tutorial for more details:

And I assume you are aware of docu.glyphsapp.com?

I have repeatedly read these two articles. But I didn’t find a way to express these six parameters.
I want to extract the original parameters for the calculation of the new parameters.

The transform parameter returns a tuple of six float. And you can assign the same back.

How can I assign the same back?
Could you give me a demonstration?

scaleX = component.transform.scale.x, # AttributeError: ‘tuple’ object has no attribute ‘scale’
skewX = component.transform.skew.x,
skewY = component.transform.skew.y,
scaleY = component.transform.scale.y,
positionX = component.transform.position.x, # This is wrong
positionY = component.transform.position.y, # What can I do?

component.transform = ((
scaleX / 1.096, # x scale factor
skewX, # x skew factor
skewY, # y skew factor
scaleY / 1.725, # y scale factor
positionX - scalex * 6, # x position
positionY - scaley * 9 # y position
))

To figure out what data you get from a proper, just print it and check the type:

print "transform", type(component.transform), component.transform

transform <type ‘tuple’> (1.0, 0.0, 0.0, 1.0, 0.0, 0.0)

As you can see, you get a tuple with six numbers. You can use tuple unpacking like this:

scaleX, skewX, skewY, scaleY, positionX, positionY = component.transform

and set it like this:

component.transform = scaleX, skewX, skewY, scaleY, positionX, positionY

I am really happy!Thank you so much!!:star_struck::star_struck::star_struck::hugs::hugs::hugs: