import xbmcgui ACTION_PREVIOUS_MENU = 10 """ Biggest problem is no good way to make sure the id your getting exists or is the correct type Im not sure how the rest of XBMC handles this (if a skinner gives a button instead of a list control """ class WindowXML(xbmcgui.WindowXML): def init(self): """ This function should be executed by XBMC after the xml has bene loaded """ if (self.getControl(3).getType() == "list"): # this doubles checks that so we don't make mistakes [design flaw needs rethinking self.listctrl = self.getControl(3) self.listctrl.addItem("hey") self.listctrl.addItem("hey2") self.listctrl.addItem("hey3") self.listctrl.addItem("hey4") def onAction(self, action): """" onAction in WindowXML works same as on a Window or WindowDialog its for keypress/controller buttons etc """ if action == ACTION_PREVIOUS_MENU: self.close() def onClick(self, controlID): """" onClick is used instead of onControl """ if (controlID == 4): print "Some Control with id 4 was pressed" if (controlID == 3): print "The list was pressed" def onFocus(self, controlID): """" onFocus is a totally new type """ if (controlID == 5): print 'The control with id="5" just got focus' w = WindowXML("Youtube_Window.xml") w.doModal() del w