Search code examples
pythonxbmc

XBMC Text are not displaying


I'm working on my python script as I would like to change the language using xml when pressing on the enter button of the keyboard.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <strings>
        <string id="32000">Hello UK</string>
    </strings>

    <control type="label">
        <description>My hello label</description>
        <posx>20</posx>
        <posy>20</posy>
        <width>180</width>
        <height>248</height>
        <align>middle</align>
        <font>font12</font>
        <textcolor>white</textcolor>
        <visible>true</visible>
        <label>$LOCALIZE[SCRIPT32000]</label>
    </control>

Here is the python:

import xbmc
import xbmcgui
import xbmcaddon

#get actioncodes from keyboard.xml
ACTION_ENTER = 7

class MyClass(xbmcgui.WindowXML):
  def onAction(self, action):
    if action == ACTION_ENTER:
      if image1_enabled:
         my_hello_string = ADDON.getLocalizedString(32000)

I have got a problem with my python script, because when I press on the enter button, there are no text display on the screen. There are no error on the xbmc logs. I want to add the label to get the strings that I stored in xml to display the strings on the skins. Not sure if I have missing something?


Solution

  • If that is your complete code, it looks like you're not doing anything with the class. You might need to add to the end of your Python code something like:

    if __name__ == '__main__':
        w = MyClass("myclass.xml")
        w.doModal()