Prevent Kivy leaving debug messages

2024/9/18 18:52:58

I have a simple a Kivy interface that also uses the terminal.

Example code:

import kivykivy.require('1.0.6')from kivy.app import App
from kivy.uix.label import Labelclass MyApp(App):def build(self):return Label(text = 'Hello')MyApp().run()

The problem is that whenever I start the script I get this:

[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...

I have found that this is Kivy's automatic debugging messages. How do I prevent them (or at least hide so that I can use the terminal)?

Answer

As shown in the docs, you should only do the following:

import os
os.environ["KIVY_NO_CONSOLELOG"] = "1"import kivy
...
https://en.xdnf.cn/q/72758.html

Related Q&A

django.db.utils.InternalError: (1050, Table django_content_type already exists)

django.db.utils.InternalError: (1050, "Table django_content_type already exists")I just copied a project from my friend, when I run makemirations it runs properly. But for - python3 manage.py…

Use SQLites backup API from Python/SQLAlchemy

Im using an SQLite database from python (with SQLAlchemy). For performance reasons, Id like to populate an in-memory database in the application, and then back up that database to disk.SQLite has a bac…

ABC for String?

I recently discovered abstract base classes (ABCs) in collections and like their clear, systematic approach and Mixins. Now I also want to create customs strings (*), but I couldnt find an ABC for stri…

Get the most relevant word (spell check) from enchant suggest() in Python

I want to get the most relevant word from enchant suggest(). Is there any better way to do that. I feel my function is not efficient when it comes to checking large set of words in the range of 100k or…

How do I get python-markdown to additionally urlify links when formatting plain text?

Markdown is a great tool for formatting plain text into pretty html, but it doesnt turn plain-text links into URLs automatically. Like this one:http://www.google.com/How do I get markdown to add tags …

Best way to read aws credentials file

In my python code I need to extract AWS credentials AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID which are stored in the plain text file as described here: https://docs.aws.amazon.com/sdkref/latest/guid…

Profiling on live Django server?

Ive never done code coverage in Python, but Im looking for something like GCCs gcov, which tells me how many times each line executes, or Apples Shark which gives a hierarchial breakdown of how long ea…

Inset axes anchored to specific points in data coordinates?

Id like to be able to overlay multiple inset axes on top of a set of parent axes, something like this:Ideally, Id like the anchor point of each set of inset axes to be fixed in data coordinates, but fo…

No module named folium.plugins, Python 3.6

I am trying to import folium into a Jupyter notebook Im working on and I cannot seem to solve the import issues with the Folium library. Has anyone else solved this problem?After encountering an error…

How you enable CBC to return best solution when timelimit? (Pyomo)

I am trying to use CBC(v2.10.3) on Pyomo to solve for a integer linear problem.When executing the solver, I am currently setting a timelimit of 600s.opt = SolverFactory ("cbc")opt.options[sec…