我正在处理我的 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 中的字符串以显示皮肤上的字符串。不确定我是否遗漏了什么?