Kodi Community Forum
Countdown timer - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
--- Thread: Countdown timer (/showthread.php?tid=230766)



Countdown timer - nero12 - 2015-06-28

Is it possible to do a countdown window in XBMC and only allow the user to proceed once the count down is complete.

For example we want a user to read some text and hold him on that window for 30 seconds to ensure he has read it .

is that possible with kodi ?


RE: Countdown timer - pipcan - 2015-06-29

PHP Code:
xbmc.sleep(30000



RE: Countdown timer - nero12 - 2015-06-30

Thank you


RE: Countdown timer - enen92 - 2015-07-02

Code:
import xbmc,xbmcgui

def handle_wait(time_to_wait,title,text):
    mensagemprogresso = xbmcgui.DialogProgress()
    ret = mensagemprogresso.create(' '+title)
    secs=0
    percent=0
    increment = int(100 / time_to_wait)
    cancelled = False
    while secs < time_to_wait:
        secs += 1
        percent = increment*secs
        secs_left = str((time_to_wait - secs))
        remaining_display = "Still " + str(secs_left) + "seconds left"
        mensagemprogresso.update(percent,text,remaining_display)
        xbmc.sleep(1000)
        if (mensagemprogresso.iscanceled()):
            cancelled = True
            break
    if cancelled == True:
        return False
    else:
        mensagemprogresso.close()
        return False
        
#To run...
handle_wait(30,"My addon","Doing magic...please wait!")

This will wait for 30 seconds with 1 second interval showing the text on the first line and the remaining time on the 2nd line.

Cheers


RE: Countdown timer - nero12 - 2015-07-03

(2015-07-02, 13:58)enen92 Wrote:
Code:
import xbmc,xbmcgui

def handle_wait(time_to_wait,title,text):
    mensagemprogresso = xbmcgui.DialogProgress()
    ret = mensagemprogresso.create(' '+title)
    secs=0
    percent=0
    increment = int(100 / time_to_wait)
    cancelled = False
    while secs < time_to_wait:
        secs += 1
        percent = increment*secs
        secs_left = str((time_to_wait - secs))
        remaining_display = "Still " + str(secs_left) + "seconds left"
        mensagemprogresso.update(percent,text,remaining_display)
        xbmc.sleep(1000)
        if (mensagemprogresso.iscanceled()):
            cancelled = True
            break
    if cancelled == True:
        return False
    else:
        mensagemprogresso.close()
        return False
        
#To run...
handle_wait(30,"My addon","Doing magic...please wait!")

This will wait for 30 seconds with 1 second interval showing the text on the first line and the remaining time on the 2nd line.

Cheers


this was exactly what i was looking for, i greatly appreciate your help!!! really very useful for me. THanks ALOT!


RE: Countdown timer - gattomatto69 - 2015-07-08

Very useful, thank you!


This forum uses Lukasz Tkacz MyBB addons.