Countdown timer
#1
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 ?
Reply
#2
PHP Code:
xbmc.sleep(30000
Reply
#3
Thank you
Reply
#4
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
Reply
#5
(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!
Reply
#6
Very useful, thank you!
Reply

Logout Mark Read Team Forum Stats Members Help
Countdown timer0