Kivy 应用程序 - 调整窗口大小时小部件消失问题

问题描述 投票:0回答:1

Kivy 用户,Kivy 爱好者,

值得注意的是,Kivy 1.9.1 版本中也报告了类似的问题,但据称已通过更新解决。然而,在当前版本(2.3.0)中,该问题再次明显出现。因此,请不要将我的问题分类为之前提出的问题。同样的问题在新版本中重复出现。

我对 Kivy 还比较陌生,几天前才开始。无论我尝试使用哪个示例代码,或者即使我尝试仅使用一个标签的简单“Hello world”应用程序,我都会遇到一致的问题。 Kivy 和 KivyMD 都存在同样的问题。

具体问题是,当我调整应用程序窗口大小时,最初一切似乎都正常,但过了一会儿,所有小部件都消失了,只留下一个空白屏幕。窗口保持响应,我仍然可以移动它并调整其大小,但所有小部件都不再可见。

任何用于排查和解决此问题的见解、指导或潜在解决方案将不胜感激。

预先感谢您的协助!

我已检查并确保以下事项:

  • 使用 Poetry 和虚拟环境安装了 Kivy 和 KivyMD 稳定版本。
  • 当问题出现时,我仔细检查了消息,发现了一个警告 KivyMD 已过时(1.2.0)
  • 对于诗歌我无法升级它,我创建了一个 pip env
pip install kivy[base] kivymd 

但再次收到相同的警告,KivyMD 版本 1.2.0 已过时...

  • 因此希望有人修复了这个错误,我创建了一个新的 pip env 并从 github 重新安装了最新的开发版本。
pip install git+https://github.com/kivy/kivy.git
pip install git+https://github.com/kivymd/KivyMD.git

  • 图形驱动程序是最新的。
  • Python最新版本为3.12。
  • Windows 11 已全面更新。
  • Kivy和KivyMD分别是最新版本3.0.1dev和2.0.0dev。 (记住我已经检查过稳定的 Kivy 版本 2.3.0)
  • 我没有使用 Anaconda 或 Miniconda。
  • OpenGL 驱动程序等会自动更新。
  • 我在我的项目或虚拟环境中找不到任何
    config.ini
    文件或此类文件来检查可能的嫌疑人。

调整应用程序窗口大小始终会随着以下屏幕和小部件消失而结束。

屏幕日志:

(venv) D:\Learning\Projects\Kivy\Udemy\hello_kivymd>d:/Learning/Projects/Kivy/Udemy/hello_kivymd/venv/Scripts/python.exe d:/Learning/Projects/Kivy/Udemy/hello_kivymd/hello/hello.py
[INFO   ] [Logger      ] Record log in C:\Users\eakar\.kivy\logs\kivy_24-01-24_7.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] [Kivy        ] v3.0.0.dev0
[INFO   ] [Kivy        ] Installed at "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Scripts\python.exe"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [KivyMD      ] 2.0.1.dev0, git-ab67546, 2024-01-23 (installed at "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Lib\site-packages\kivymd\__init__.py")
[INFO   ] [Factory     ] 195 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.6.0 Compatibility Profile Context 22.20.27.09.230330'>
[INFO   ] [GL          ] OpenGL vendor <b'ATI Technologies Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'Radeon RX 5500 XT'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version <b'4.60'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Clipboard   ] Provider: winctypes
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [Base        ] Start application main loop
[INFO   ] [KivyMD      ] Color scheme generation. Get a color scheme from an installed palette - 0.004485299999942072 sec.
 Exception ignored on calling ctypes callback function: <bound method _WindowsSysDPIWatch._wnd_proc of <kivy.core.window.window_sdl2._WindowsSysDPIWatch object at 0x00000290FB4F2F90>>
 Traceback (most recent call last):
   File "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Lib\site-packages\kivy\core\window\window_sdl2.py", line 998, in _wnd_proc
     return windll.user32.CallWindowProcW(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 OSError: exception: access violation reading 0x000002909F58E3A8
[INFO   ] [Base        ] Leaving application in prog

以及上面提到的kivy_24-01-24_7.txt文件的内容

[INFO   ] Logger: Record log in C:\Users\eakar\.kivy\logs\kivy_24-01-24_7.txt
[INFO   ] deps: Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] deps: Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] deps: Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] Kivy: v3.0.0.dev0
[INFO   ] Kivy: Installed at "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Lib\site-packages\kivy\__init__.py"
[INFO   ] Python: v3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]
[INFO   ] Python: Interpreter at "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Scripts\python.exe"
[INFO   ] Logger: Purge log fired. Processing...
[INFO   ] Logger: Purge finished!
[INFO   ] KivyMD: 2.0.1.dev0, git-ab67546, 2024-01-23 (installed at "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Lib\site-packages\kivymd\__init__.py")
[INFO   ] Factory: 195 symbols loaded
[INFO   ] Image: Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] Text: Provider: sdl2
[INFO   ] Window: Provider: sdl2
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: GLEW initialization succeeded
[INFO   ] GL: Backend used <glew>
[INFO   ] GL: OpenGL version <b'4.6.0 Compatibility Profile Context 22.20.27.09.230330'>
[INFO   ] GL: OpenGL vendor <b'ATI Technologies Inc.'>
[INFO   ] GL: OpenGL renderer <b'Radeon RX 5500 XT'>
[INFO   ] GL: OpenGL parsed version: 4, 6
[INFO   ] GL: Shading version <b'4.60'>
[INFO   ] GL: Texture max size <16384>
[INFO   ] GL: Texture max units <32>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[INFO   ] Clipboard: Provider: winctypes
[INFO   ] GL: NPOT texture support is available
[INFO   ] Base: Start application main loop
[INFO   ] KivyMD: Color scheme generation. Get a color scheme from an installed palette - 0.004485299999942072 sec.
[WARNING] stderr: Exception ignored on calling ctypes callback function: <bound method _WindowsSysDPIWatch._wnd_proc of <kivy.core.window.window_sdl2._WindowsSysDPIWatch object at 0x00000290FB4F2F90>>
[WARNING] stderr: Traceback (most recent call last):
[WARNING] stderr:   File "d:\Learning\Projects\Kivy\Udemy\hello_kivymd\venv\Lib\site-packages\kivy\core\window\window_sdl2.py", line 998, in _wnd_proc
[WARNING] stderr:     return windll.user32.CallWindowProcW(
[WARNING] stderr:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[WARNING] stderr: OSError: exception: access violation reading 0x000002909F58E3A8
[INFO   ] Base: Leaving application in progress...

kivy widget kivymd window-resize
1个回答
0
投票

KivyMD 已更新至 2.0 并添加了该警告消息。继续用1.20就可以了。 请参阅:https://github.com/kivymd/KivyMD?tab=readme-ov-file#installation

KivyMD 2.0.0 尚未在 PyPI 上运行。我建议使用 KivyMD 1.2,直到 kivymd 2.0 版本文档发布并且可以从 Pypi 获取代码。

© www.soinside.com 2019 - 2024. All rights reserved.