Issue with python class in Kodi, trying to write a UI to replace Kodi generic menu with PYXBMCT
<p>I'm quite new to python class's and have not really used them much so please feel free to point out any other errors except the one I point out. </p>

<p>What I'm trying to achieve is a new <code>UI in Kodi</code> using the <code>pyxbmct</code> module. I'm sending through a list of things (still yet to work out how I'm going to sort the split to next process with the modes but that's the next task)</p>

<p>My Lists are as such:</p>

<pre><code>List = [['[COLOR darkgoldenrod][I]Search[/I][/COLOR]','',904,'http://icons.iconarchive.com/icons/icontexto/search/256/search-red-dark-icon.png','','',''],
['[COLOR darkgoldenrod][I]Menu Test[/I][/COLOR]','',905,'http://icons.iconarchive.com/icons/icontexto/search/256/search-red-dark-icon.png','','','']]
process.Window_Menu_Class(List)
</code></pre>

<p>Then obviously being sent through to the Window_Menu_Class() to attempt to display the name(s) in a List and also display a icon to the right but alternating depending on where you are focused in the List. </p>

<p>Code for Window_Menu_Class :-</p>

<pre><code>import pyxbmct
List = []

class Window_Menu_Class():

    fanart = 'http://www.wall321.com/thumbnails/detail/20121108/creepy%20video%20games%20castles%20diablo%20tristram%20creep%20diablo%20iii%20sanctuary%201920x1080%20wallpaper_www.wall321.com_92.jpg'
    iconimage = ICON
    power = 'http://herovision.x10host.com/fb_replays/power.png'
    power_focus = 'http://herovision.x10host.com/fb_replays/power_focus.png'
    text = '0xffffffff'
    window_menu  = pyxbmct.AddonDialogWindow('')
    Background=pyxbmct.Image(fanart)
    Icon=pyxbmct.Image('', aspectRatio=2)
    button = pyxbmct.Button('', noFocusTexture=power,focusTexture=power_focus)
    window_menu.setGeometry(1250, 650, 100, 50)
    nameList = pyxbmct.addonwindow.List(_space=11,_itemTextYOffset=0,textColor=text)
    window_menu.connect(button, window_menu.close)
    window_menu.connect(pyxbmct.ACTION_NAV_BACK, window_menu.close)
    window_menu.placeControl(Background, -5, 0, 110, 51)
    window_menu.placeControl(nameList, 65, 1, 50, 20)
    window_menu.placeControl(Icon, 30, 30, 60, 18)    
    name_list = [];    url_list = [];    mode_list = [];    iconimage_list = [];    fanart_list = [];    desc_list = [];    extra_list = []

def __init__(self,List):
    self.Window_Menu(List)

def Window_Menu(self,List):
    for item in List:
        name = item[0]
        url = item[1]
        mode = item[2]
        iconimage = item[3]
        fanart = item[4]
        desc = item[5]
        extra = item[6]
        if not name in self.name_list:
            self.nameList.addItem(name);self.name_list.append(name);self.url_list.append(url);self.mode_list.append(mode);self.iconimage_list.append(iconimage);self.fanart_list.append(fanart);self.desc_list.append(desc);self.extra_list.append(extra)
            self.create_window(name,url,mode,iconimage,fanart,desc,extra)
    self.window_menu.doModal()


def create_window(self,name,url,mode,iconimage,fanart,desc,extra):
    self.window_menu.setFocus(self.nameList)
    self.window_menu.connectEventList(
    [pyxbmct.ACTION_MOVE_DOWN,
    pyxbmct.ACTION_MOVE_UP,
    pyxbmct.ACTION_MOUSE_MOVE],
    self.LIST_UPDATE(name,url,mode,iconimage,fanart,desc,extra))


def LIST_UPDATE(self,name,url,mode,iconimage,fanart,desc,extra):
    if self.window_menu.getFocus() == self.nameList:
        pos=self.nameList.getSelectedPosition()
        Iconimg=self.iconimage_list[pos]
        Fanart =self.fanart_list[pos]
        self.Icon.setImage(Iconimg)
        self.Background.setImage(Fanart)
</code></pre>

<p>but I receive the error - </p>

<p>File "C:\Users*\AppData\Roaming\Kodi\addons\plugin.video.sanctuary\lib\process.py", line 74, in LIST_UPDATE
                                                if self.window_menu.getFocus() == self.nameList:
                                            RuntimeError: Non-Existent Control 0</p>

<p>If I hash out the <code>if self.window_menu.getFocus() == self.nameList:</code> then it works but, it doesn't alter the image in the list when you move on to the next item, I have a working version but it was all done in one .py file and no need for class at all, however now I am trying to separate the code into different .py files i needed to create a class to contain all the info and give a starting point.  Hope this is enough information and appreciate any feedback.</p>

<p>Your problem does not have a simple answer because you are doing it wrong at both Python level and PyXBMCt level (I'm the author of PyXBMCt, BTW).</p>

<p>First, I strongly recommend you to learn Python classes: how they are defined, how they are initialized, how they are used.</p>

<p>When you get that in order, then I strongly recommend to read PyXBMCt documentation which is now hosted here: <a href="http://romanvm.github.io/script.module.pyxbmct/" rel="nofollow">http://romanvm.github.io/script.module.pyxbmct/</a> Look into the examples, including the example plugin, that show how to use PyXBMCt. For example, what is this <code>window_menu.placeControl(Background, -5, 0, 110, 51)</code>? PyXBMCt does not use pixels, it places controls in a grid with rows and columns and you need to set up the grid first.</p>

<p>Anyway, I recommend to start with Python stuff first.</p>

python class kodi