1

我正在处理我的 python 脚本,因为我想在按下键盘的 enter 按钮时使用 xml 更改语言。

<?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>

这是蟒蛇:

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)

我的 python 脚本有问题,因为当我按下回车按钮时,屏幕上没有文本显示。xbmc 日志上没有错误。我想添加标签以获取我存储在 xml 中的字符串以显示皮肤上的字符串。不确定我是否遗漏了什么?

4

1 回答 1

0

如果这是您的完整代码,那么您似乎没有对课程做任何事情。您可能需要在 Python 代码的末尾添加如下内容:

if __name__ == '__main__':
    w = MyClass("myclass.xml")
    w.doModal()
于 2014-01-23T06:04:41.537 回答