Random integers in control tag values (top, bottom, left, right)
#1
I have the following in "resources/skins/default/1080i/myaddon.xml":

xml:

<control type="group">
  <orientation>vertical</orientation>
  <top>800</top>
  <right>120</right>
  <control type="grouplist">
  ...
</control>

I would like "800" and "120" to be random values within a certain range, e.g. 750-850 and 100-150 respectively. I would like the random value to be set each time the XML contents are drawn, and then again only when it is loaded again.

I see that control tags may contain some builtin conditional functions like String.IsEqual, etc., but I haven't found a way to return random integers.

How can I achieve this?
Reply
#2
For future readers, what I ended up doing was controlling the Control's position via the addon's Python logic.
I gave the Control an ID I can use to call it:
xml:

<control type="group" id="109">

Then from my "gui.py":
python:

self.myControl = self.getControl(109)
self.initialPositionX = self.myControl.getX()
self.initialPositionY = self.myControl.getY()
newPositionX = self.initialPositionX + random.randint(0, 60)
newPositionY = self.initialPositionY + random.randint(-30, 30)
self.myControl.setPosition(newPositionX, newPositionY)
Reply

Logout Mark Read Team Forum Stats Members Help
Random integers in control tag values (top, bottom, left, right)0