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 ?
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
(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!