Maya resize window and keep ratio/proportions


#1

Hello everyone,

It is the first time I post something here.
I have been searching a lot for this solution, but I couldn’t find any answer to my question.

I’m trying to create (with python or mel, but preferably python) a resizeable window, but that keep original ratio/proportions when resized.
I could not find any “resizeCommand” flag, or lock ratio. I am using Maya 2016.

Another solution I considered, instead of locking the window ratio, would be to create a default resizeable window, and set a child in it, that would keep its original ratio but expand to adapt the window size (and make margins appear if need be).

Do you think it is possible to do such things ?

Thank you very much and have a bice afternoon ! :slight_smile:


#2

You’re looking for formLayout command. It’s a little more involved to get your UIs working correctly, but it allows scalability. You specify corners of the form layout to attach to other layouts/positions, and it will maintain those relationships as you scale the window. If you look at the documentation that Autodesk has for it, there’s an example at the bottom of the page where buttons are attached within the layout.

Autodesk formLayout


#3

All right, I think I tried it already, but I will reconsider it ang get more involved into this one.
Thank you, I’ll come back when I’ll find a bit of time to test it !

Cheers