Need help - why does my function not work - thumbnail related - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Need help - why does my function not work - thumbnail related (/showthread.php?tid=39585) |
Need help - why does my function not work - thumbnail related - cheetah05 - 2008-10-28 Basically it's to add a video link to a list: Code: def AddListItem (Name, Url, Image): If the Image parameter is null then it displays the DefaultVideo.png image fine. But the parameter actually has an image filename input then it displays nothing. I have checked and the image does exist in the folder: %plugin_dir%\images\. Have tried another image too just to make sure it isn't the image. Also made sure I imported os & os.path. What am I doing wrong? Syntax error? (This is my first hour of python ) Thanks. - BigBellyBilly - 2008-10-28 your number of parms to ListItem is incorrect, missing a label2 before giving the image. http://xbmc.sourceforge.net/python-docs/xbmcgui.html#ListItem ListItem([label, label2, iconImage, thumbnailImage]) eg listitem = xbmcgui.ListItem('Casino Royale', '[PG-13]', 'blank-poster.tbn', 'poster.tbn') so your example should be: guiListItem = xbmcgui.ListItem (Name, "", Image, Image) Python will let you reference parms by name should you wish to exclude some: eg. guiListItem = xbmcgui.ListItem (Name, iconImage=Image, thumbnailImage=Image) You might also want to assign a var to your images location then your func doesn't have to build it each time. eg. DIR_HOME = os.getcwd () DIR_IMAGES = os.path.join (DIR_HOME , 'images' ) then in func: eg. imgPath = os.path.join (DIR_IMAGES, Image) BBB - cheetah05 - 2008-10-28 Knew it was something stupid. Thanks! - Working now. EDIT: Now it doesn't show the "DefaultVideo.png" for some reason |