How to operate on multiple selected glyphs at once

I’m sorry, last time I probably didn’t make it clear.
I made a demo animation.This is a dynamic graph, and it may need to be clicked and open to see the effect.
Like this, I choose four glyphs. When I run, only the first can change, and the remaining three doesn’t respond.
I want to change the four selected at once.

from Foundation import NSMidY
myAscender = Font.selectedFontMaster.ascender
myDescender = Font.selectedFontMaster.descender
mycenterY = (myAscender + myDescender) / 2.0
for layer in Glyphs.font.selectedLayers:
bounds = Layer.bounds
centerY = NSMidY(bounds)
shift = mycenterY - centerY
layer.applyTransform([
1, # x scale factor
0.0, # x skew factor
0.0, # y skew factor
1, # y scale factor
0.0, # x position
shift # y position
])

You are iterating through Glyphs.font.selectedLayers but using Layer instead of layer which is the iteration variable of this for loop. Putting a print statement inside the loop always helps debugging :wink:

As a side note remember that this script may result in glyphs being shifted 1pt up/down as the result of rounding to the grid.

:star_struck::star_struck:Thank you very much. :hugs::hugs: