用Tide-SDK打包Python应用程序不起作用,而Launch应用程序可以

2024-05-19 17:03:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在用Python开发一个用于跳跃运动的应用程序,当我测试它时,当我单击Launch app时,它运行得很好。没有打开任何应用程序窗口,但是Python代码运行良好。在

但是,当我打包并启动应用程序时,它确实显示了一个应用程序窗口,而Python根本就不工作了。。。我错过什么了吗?在

这是我的密码索引.html公司名称:

<html>
    <head>
        <script>
            Titanium.include("PyLeapMouse.py");
            Titanium.include("Geometry.py");
            Titanium.include("Leap.py");
            Titanium.include("LeapFunctions.py");
            Titanium.include("Mouse.py");
        </script>
        <script type="text/python">
            import Leap
            import Mouse
            import LeapFunctions
            import time
            import sys

            def main():
                cursor = Mouse.cursor()
                listener = LeapFunctions.Listener(cursor)

                controller = Leap.Controller()
                print "Adding Listener."
                controller.add_listener(listener)#Attach the listener

                print "Press Enter to quit..."
                sys.stdin.readline()
                controller.remove_listener(listener)

            main()
        </script>
    </head>
    <body style="background-color:#1c1c1c;margin:0">
    </body>
</html>

Tags: pyimport应用程序includehtmlsysscripthead
2条回答

尝试以下列方式包含Python模块:

<script type="text/python" src="PyLeapMouse.py" />
<script type="text/python" src="Geometry.py" />
<script type="text/python" src="Leap.py" />
<script type="text/python" src="LeapFunctions.py" />
<script type="text/python" src="Mouse.py" />

我知道全局命名空间也从Titanium更改为Ti,因此如果这不起作用,您可能需要尝试Ti.include与{}。在

希望能奏效。在

相关问题 更多 >