我正在为 xbmc 程序使用 python 脚本,我可以毫无问题地打开 addons.py,但我无法从 addons.py 打开 test.py。我目前在两个不同的文件 addons.py 和 test.py 上使用代码。
插件.py:
import xbmcgui
import xbmcaddon
import buggalo
from test import MyClass
buggalo.SUBMIT_URL = 'http://tommy.winther.nu/exception/submit.php'
try:
w = xbmcgui.WindowXML( "script-tvguide-mainmenu.xml", xbmcaddon.Addon().getAddonInfo('path'), "Default" )
w.doModal()
del w
print 'Hello!'
mydisplay = MyClass()
mydisplay.doModal()
except Exception:
buggalo.onExceptionRaised()
测试.py:
print "hello!"
import xbmc
import xbmcgui
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_MOVE_LEFT = 1
ACTION_MOVE_RIGHT = 2
ACTION_MOVE_UP = 3
ACTION_MOVE_DOWN = 4
class MyClass(xbmcgui.WindowXML):
def onAction(self, action):
if action == ACTION_MOVE_LEFT:
print "You have press on the left arrow button!"
self.close()
if action == ACTION_MOVE_RIGHT:
print "You have press on the right arrow button!"
self.close()
if action == ACTION_MOVE_UP:
print "You have press on the up arrow button!"
self.close()
if action == ACTION_MOVE_DOWN:
print "You have press on the down arrow button!"
self.close()
我真的需要你的帮助,因为当我打开 addons.py 时,我无法从 addons.py 打开 test.py。它会给我一个错误function takes at least 2 arguments (0 given)
。我不知道该怎么办。
这是日志: http: //pastebin.com/Qacy0UnA
有谁知道我如何从 addons.py 脚本打开 test.py ?