Autoclose dialog ok box
#1
Hi there,

Im trying to autoclose my dialog ok box like I have in the yes.no box but im up against to many arguments.

Can someone help?

Code:
import xbmc, xbmcaddon, xbmcgui
import time
import xbmc, sys
import requests


def MYIP(url='https://api.ipify.org/'):
ip = requests.get(url).content
dialog=xbmcgui.Dialog()
dialog.ok('IP ADDRESS',"[COLOR gold]Your IP Address is: [/COLOR] %s" % ip) # WOULD LIKE AUTOCLOSE THIS BOX


choice = xbmcgui.Dialog().yesno('TEST', 'view ip', nolabel='NO',yeslabel='YES', autoclose=int(10000))

if choice == 0:
dialog = xbmcgui.Dialog()
dialog.notification('[COLOR lime]KODI[/COLOR]', 'Test', xbmcgui.NOTIFICATION_INFO, 10000)

elif choice == 1:

MYIP()
Reply
#2
xbmcgui.Dialog().ok() does not support autoclose (only the yesno does). There's already a feature request for that
Reply
#3
(2022-01-26, 13:50)enen92 Wrote: xbmcgui.Dialog().ok() does not support autoclose (only the yesno does). There's already a feature request for that

What would be nice would be adding a close() method to the xbmcgui.Dialog().ok and xbmcgui.Dialog().notification objects.  This way we can close them as needed.  I had a need for this yesterday for a background asynchronous event.  I ended up cobbling together a progress window. 


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#4
Is this what you are after?

python:

import time
from threading import Thread

import xbmc
import xbmcgui

def autoCloseDialog():
    time.sleep(5)
    xbmc.executebuiltin("Dialog.Close(okdialog)")

Thread(target=autoCloseDialog).start()
xbmcgui.Dialog().ok("Test", "Does this function?")
Reply

Logout Mark Read Team Forum Stats Members Help
Autoclose dialog ok box0