1. <legend id='3kxEn'><style id='3kxEn'><dir id='3kxEn'><q id='3kxEn'></q></dir></style></legend>

    <tfoot id='3kxEn'></tfoot>
  2. <i id='3kxEn'><tr id='3kxEn'><dt id='3kxEn'><q id='3kxEn'><span id='3kxEn'><b id='3kxEn'><form id='3kxEn'><ins id='3kxEn'></ins><ul id='3kxEn'></ul><sub id='3kxEn'></sub></form><legend id='3kxEn'></legend><bdo id='3kxEn'><pre id='3kxEn'><center id='3kxEn'></center></pre></bdo></b><th id='3kxEn'></th></span></q></dt></tr></i><div id='3kxEn'><tfoot id='3kxEn'></tfoot><dl id='3kxEn'><fieldset id='3kxEn'></fieldset></dl></div>

        <bdo id='3kxEn'></bdo><ul id='3kxEn'></ul>

    1. <small id='3kxEn'></small><noframes id='3kxEn'>

      如何分析 Kivy 应用程序?

      时间:2023-10-09
        <bdo id='ZVFTb'></bdo><ul id='ZVFTb'></ul>
          <tbody id='ZVFTb'></tbody>

        <tfoot id='ZVFTb'></tfoot>

        1. <i id='ZVFTb'><tr id='ZVFTb'><dt id='ZVFTb'><q id='ZVFTb'><span id='ZVFTb'><b id='ZVFTb'><form id='ZVFTb'><ins id='ZVFTb'></ins><ul id='ZVFTb'></ul><sub id='ZVFTb'></sub></form><legend id='ZVFTb'></legend><bdo id='ZVFTb'><pre id='ZVFTb'><center id='ZVFTb'></center></pre></bdo></b><th id='ZVFTb'></th></span></q></dt></tr></i><div id='ZVFTb'><tfoot id='ZVFTb'></tfoot><dl id='ZVFTb'><fieldset id='ZVFTb'></fieldset></dl></div>

            <small id='ZVFTb'></small><noframes id='ZVFTb'>

            • <legend id='ZVFTb'><style id='ZVFTb'><dir id='ZVFTb'><q id='ZVFTb'></q></dir></style></legend>

              • 本文介绍了如何分析 Kivy 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在使用 Kivy 构建游戏.我遇到了性能问题,所以我决定分析该程序.

                I'm building a game using Kivy. I'm encountering performance issues so I decided to profile the program.

                我尝试通过以下方式运行它:

                I tried to run it by:

                python -m cProfile main.py
                

                应用程序屏幕保持黑色.几秒钟后,一个异常使程序崩溃:

                The application screen stays black. After several seconds, an exception crashes the program:

                 Traceback (most recent call last):
                   File "c:python27Lib
                unpy.py", line 162, in _run_module_as_main
                     "__main__", fname, loader, pkg_name)
                   File "c:python27Lib
                unpy.py", line 72, in _run_code
                     exec code in run_globals
                   File "c:python27LibcProfile.py", line 199, in <module>
                     main()
                   File "c:python27LibcProfile.py", line 192, in main
                     runctx(code, globs, None, options.outfile, options.sort)
                   File "c:python27LibcProfile.py", line 49, in runctx
                     prof = prof.runctx(statement, globals, locals)
                   File "c:python27LibcProfile.py", line 140, in runctx
                     exec cmd in globals, locals
                   File "main.py", line 26, in <module>
                     GameApp().run()
                   File "C:UsersAvivEnvsgamelibsite-packageskivyapp.py", line 828, in run
                     runTouchApp()
                   File "C:UsersAvivEnvsgamelibsite-packageskivyase.py", line 487, in runTouchApp
                     EventLoop.window.mainloop()
                   File "C:UsersAvivEnvsgamelibsite-packageskivycorewindowwindow_sdl2.py", line 619, in mainloop
                     self._mainloop()
                   File "C:UsersAvivEnvsgamelibsite-packageskivycorewindowwindow_sdl2.py", line 403, in _mainloop
                     x, y = self._fix_mouse_pos(x, y)
                   File "C:UsersAvivEnvsgamelibsite-packageskivycorewindowwindow_sdl2.py", line 358, in _fix_mouse_pos
                     self.mouse_pos = x, self.system_size[1] - y
                   File "kivyproperties.pyx", line 408, in kivy.properties.Property.__set__ (kivyproperties.c:5114)
                   File "kivyproperties.pyx", line 446, in kivy.properties.Property.set (kivyproperties.c:5876)
                   File "kivyproperties.pyx", line 501, in kivy.properties.Property.dispatch (kivyproperties.c:6557)
                   File "kivy\_event.pyx", line 1224, in kivy._event.EventObservers.dispatch (kivy\_event.c:13497)
                   File "kivy\_event.pyx", line 1130, in kivy._event.EventObservers._dispatch (kivy\_event.c:12696)
                   File "gameopening_screen.py", line 22, in _on_mouse_pos
                     if self.ids.start_button.collide_point(*position):
                   File "kivyproperties.pyx", line 757, in kivy.properties.ObservableDict.__getattr__ (kivyproperties.c:11882)
                 AttributeError: 'super' object has no attribute '__getattr__'
                

                为什么会发生这种情况,如何分析我的 Kivy 应用程序?

                Why is this happening, and how can I profile my Kivy application?

                推荐答案

                kivy 文档声明您无法从命令行执行此操作.

                The kivy docs state that you cannot do it from the command line.

                https://kivy.org/docs/api-kivy.app.html

                你可以这样做:(从文档复制)

                You can do it like this: (copied from the docs)

                import cProfile
                
                class MyApp(App):
                    def on_start(self):
                        self.profile = cProfile.Profile()
                        self.profile.enable()
                
                    def on_stop(self):
                        self.profile.disable()
                        self.profile.dump_stats('myapp.profile')
                

                这篇关于如何分析 Kivy 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Python kivy - 如何减少 TextInput 的高度 下一篇:带有boxlayout的kivy滚动视图

                相关文章

                最新文章

                    <bdo id='nyACT'></bdo><ul id='nyACT'></ul>

                    <tfoot id='nyACT'></tfoot>
                    <i id='nyACT'><tr id='nyACT'><dt id='nyACT'><q id='nyACT'><span id='nyACT'><b id='nyACT'><form id='nyACT'><ins id='nyACT'></ins><ul id='nyACT'></ul><sub id='nyACT'></sub></form><legend id='nyACT'></legend><bdo id='nyACT'><pre id='nyACT'><center id='nyACT'></center></pre></bdo></b><th id='nyACT'></th></span></q></dt></tr></i><div id='nyACT'><tfoot id='nyACT'></tfoot><dl id='nyACT'><fieldset id='nyACT'></fieldset></dl></div>
                  1. <legend id='nyACT'><style id='nyACT'><dir id='nyACT'><q id='nyACT'></q></dir></style></legend>

                  2. <small id='nyACT'></small><noframes id='nyACT'>