Forum Archive

Aspect ratio of an image view?

metawops

Hi,

in the UI editor of a Python script action I created a ScrollView and inside that ScrollView I embedded an ImageView.
At design time I have to set the dimensions of that image view. Currently it's the default square (200x200).

Via the Image URL property I loaded a non-square image that's displayed distorted now because the view want to make both, the width & the height to fit.

Is there a way to tell the IamgeView not to squeeze my non-square image into the square view?
I want to add several more ImageViews later and they all should be square but the actual images won't be square most of the time.

Thanks,
Stefan.

metawops

Oh! I found something!
Looks like I have to set the property content_mode of the ImageView.
Like this:

view.subviews[0].subviews[0].content_mode = ui.CONTENT_SCALE_ASPECT_FIT

I can't find this property in the UI editor. So I have to set it at run time?