Kodi Community Forum

Full Version: getCurrentWindowID()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Quote:import xbmc,xbmcgui

action_menu = 10 ##remote: menu
action_select_item = 7

class test(xbmcgui.window):
def (self):
self.addcontrol(xbmcgui.controlimage(0,0,720,480, "q:\\scripts\\image_background.png"))

def onaction(self,action):
if action == action_menu:
self.close()
if action == action_select_item:
print "here" # <- no problem printing
x = xbmcgui.getcurrentwindowid()
print str(x) # <- doesn't print that

mydisplay = test()
mydisplay.domodal()
del mydisplay

when i run the above code, i get a red bg screen. when i press 'a' i would expect two lines to be printed. instead, the log only shows 'here' as being printed. am i using the xbmcgui.getcurrentwindowid() function incorrectly?

thanks!
just to rule out the print command doing something funny with the strings, try adding a:

print "there"

before the:

print str(x)

as far as i can tell from the code, the xbmc side of this function seems to be doing what it's requested (returns the id of the current window).

cheers,
jonathan
i apologize for not doing that earlier; usually i'm smart enough to go step-by-step. yet, when i add:

Quote:print "there"
between lines as you instructed, "there" does not print.

to clarify that getcurrentwindowid() was erroring, i added:

Quote:try:
x = xbmcgui.getcurrentwindowid()
except:
print "error"
print exception
and "error" and "exceptions.exception" get printed.

now that i for sure know that xbmcgui.getcurrentwindowid() is the problem, how am i going about using it wrong, or is it simply xbmc's *fault*. i googled and tried these forums, but have been unable to locate any relevent information.

thanks for the help!

(i did find a cool xbmc app though, but i can't get it to work: xbmc control desktop)
what does your logfile say about that problem?