How to get size for a model ?

I have a lot of model. I want to the model into button, but they does not look good, because these model size are difference.

How can adjusting the model size in the button automation?

for name in ["hair_back_01","hair_back_02","hair_back_04","hair_back_05","hair_back_07",			"hair_back_08","hair_back_09","hair_back_10"]:
	model = loader.loadModel('models/'+name)
	DirectButton(geom = (model),scale=0.1,pos=(x,0,z),frameSize=(-1,1,0,2),relief=1,frameColor=(0.3,0.3,0.3,0.3),extraArgs=[name],command=self.hairBack).reparentTo(panel)
	x = x + 0.25
	if x > 0.7:
		x = 0.15
		z = z - 0.25

I know use geom_pos, geom_hpr and geom_scale, but I can’t get the size for model.

You can use getTightBounds on the model NodePath to get two coordinates for the model’s bounding box (min and max, respectively) and use that to adjust the size in your GUI.

Thank you.

b = model.getTightBounds()
DirectButton(geom = (model),geom_scale=0.12/(b[1][2]-b[0][2]),geom_pos=(0,0,-(b[0][2]+b[1][2])*0.06/(b[1][2]-b[0][2])),pos=(x,0,z),frameSize=(-0.1,0.1,-0.1,0.1),relief=1,frameColor=(0.3,0.3,0.3,0.3),extraArgs=[name],command=self.changeCoat).reparentTo(panel)