Kodi Community Forum

Full Version: Python add-on with Custom XML - Label in List with differing width.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The List I have has items with names that are as low as 5 characters and as high as 18 characters. 

Instead of this code below: 

<width>150</width>
<label>$INFO[ListItem.Label]</label>

I can try something like this for <width> :

<width>$INFO[ListItem.Property("Width"]</width>
<label>$INFO[ListItem.Label]</label>

The problem I see is that when I set property in Python, it requires me to set it as a string. So this will likely not work. Maybe I can hack my way by using "ProgressPercent" as that may give me an integer. 

But then what do I do with the width in <ItemLayout>.

Is there a way to achieve a List with Items of differing Widths ?

​​​​​​​Thanks in advance
It appears that you are trying to create a multicolumn list display. If the column widths are static, just hard code the width of each itemlayout label.
It's my understanding that a lot of the "niceties" skinners have available to them are not available to add-on developers. Features like includes and defined constants are nice features skinners can take advantage of but we can't.
I believe what you're looking for is "auto size"
https://kodi.wiki/view/Label_control#Auto_size_labels

If you are new to Kodi development, I suggest you take a few minutes to read over the wiki Smile

BTW you cannot use infolabels/Properties for width. If you need dynamic control over your scripts skin elements I suggest you use.
https://codedocs.xyz/xbmc/xbmc/group__py...ntrol.html
Thanks @jmooremcc . I will look try that out and report back.
Thanks @Lunatixz . 'auto size' is indeed interesting. I will play around with that to see if that will help me achieve what I'm trying here. :-)

I am still fairly new and consult the wiki for specific sections as I run into them. I guess I should sit back and try to go through the documentation once at least.