gpt4 book ai didi

python - 防止 Kivy 留下调试信息

转载 作者:太空宇宙 更新时间:2023-11-04 08:34:25 25 4
gpt4 key购买 nike

我有一个简单的 Kivy 界面,它也使用终端。

示例代码:

import kivy

kivy.require('1.0.6')

from kivy.app import App
from kivy.uix.label import Label

class MyApp(App):
def build(self):
return Label(text = 'Hello')

MyApp().run()

问题是,每当我启动脚本时,我都会得到这个:

[INFO   ] [Logger      ] Record log in C:\Users\Simon\.kivy\logs\kivy_18-05-12_37.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using <thread> for socket
[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.5.13467 Compatibility Profile Context 21.19.414.1280'>
[INFO ] [GL ] OpenGL vendor <b'ATI Technologies Inc.'>
[INFO ] [GL ] OpenGL renderer <b'AMD Radeon R7 Graphics'>
[INFO ] [GL ] OpenGL parsed version: 4, 5
[INFO ] [GL ] Shading version <b'4.50'>
[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 ] [Base ] Start application main loop
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Base ] Leaving application in progress...

我发现这是Kivy的自动调试信息。我该如何阻止它们(或至少隐藏以便我可以使用终端)?

最佳答案

docs所示,您应该只执行以下操作:

import os
os.environ["KIVY_NO_CONSOLELOG"] = "1"

import kivy
...

关于python - 防止 Kivy 留下调试信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50308757/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com