Kodi Community Forum

Full Version: Move text in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there,

i´m working on a small text ticker addon. That means that, after you had input a desired text, the text is printed to the screen and is moving to the right.
When the text has reached the end it shall start from the left again.

Problem here is that i have no idea how to realise the animation.

Here is my code so far:

PHP Code:
import xbmcaddon
import xbmcgui

__addon__ 
xbmcaddon.Addon()
__addonname__ __addon__.getAddonInfo('name')

input xbmcgui.Dialog().input("Geben sie ihren Text ein: ", )

xbmcgui.Dialog().notification("ausgabe"input)

script xbmcgui.Window()

label xbmcgui.ControlLabel(1010300800input"font35_title")

script.addControl(label)

script.doModal()

posx label.getX()

while(
True):

    
label.setPosition(posx 1label.getHeight()) 
(2016-01-21, 09:49)seishinsan Wrote: [ -> ]... the text is printed to the screen and is moving to the right.
When the text has reached the end it shall start from the left again.

So it's not English then?
what? i just want to move the text/label on the screen.
there's no need for the while loop. you can add an animation to a control:
http://mirrors.xbmc.org/docs/python-docs...Animations


Code:
label.setAnimations([('conditional', 'condition=true effect=slide start=10,10 end=1280,10 time=5000 loop=true',)])
(2016-01-21, 12:21)ronie Wrote: [ -> ]there's no need for the while loop. you can add an animation to a control:
http://mirrors.xbmc.org/docs/python-docs...Animations


Code:
label.setAnimations([('conditional', 'condition=true effect=slide start=10,10 end=1280,10 time=5000 loop=true',)])

yeah, i tried that but it doesn´t work. Nothing is happening with that or any other animation.
set the animation after adding the control to the window.
(2016-01-21, 12:53)ronie Wrote: [ -> ]set the animation after adding the control to the window.

doesn´t work. tried to place it everwhere i could already
works for me.
Code:
import xbmcaddon
import xbmcgui

__addon__ = xbmcaddon.Addon()
__addonname__ = __addon__.getAddonInfo('name')

input = xbmcgui.Dialog().input("Geben sie ihren Text ein: ", )
xbmcgui.Dialog().notification("ausgabe", input)

script = xbmcgui.Window()

label = xbmcgui.ControlLabel(10, 10, 300, 800, input, "font35_title")
script.addControl(label)
label.setAnimations([('conditional', 'condition=true effect=slide start=10,10 end=1280,10 time=5000 loop=true',)])

script.doModal()
Thanks ronie, the setAnimations code worked for me.

Code:
ctl3.setAnimations([('conditional', 'condition=true pulse=true effect=zoom end=150 time=2000')])

I'm just adding an observation (I must be missing something):

if you don't add "pulse=true" or "loop=true" you'll end up with just the end of animation.
Setting them to "false" won't work, it has to be "true"


Code:
ctl3.setAnimations([('WindowOpen', 'effect=zoom loop=true start=10 end=150 time=2000') ])
works. loop and pulse is ignored for WindowOpen

testing on krypton windows