禁用Pygame控制台输出 [英] Disable the Pygame console Output

查看:245
本文介绍了禁用Pygame控制台输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何在Python中禁止控制台输出?

目前我使用pygame读取操纵杆输入,我有以下问题,我需要解决。

Currently I am using pygame to read joystick input and I have the following issue that I need to solve.

在操纵杆模块中调用函数,如 get_axis() get_button()该函数打印出如 SDL_JoystickGetButton value:0: code>我需要禁用这些行的输出到控制台。

When calling functions in the joystick module such as get_axis() or get_button() the function prints out lines such as SDL_JoystickGetButton value:0: I need to disable the output of these lines to the console.

我在stackoverflow上找到了以下问题/答案,这正是我正在寻找...

I have found the following question/answer on stackoverflow which is what I'm looking for...

如何在Python中取消控制台输出?

但是这篇文章没有提供足够的信息。因为如果我必须关闭DEBUG,我想知道如何做的步骤。到目前为止,我已经下载了pygame源,并进入joystick.c并注释掉打印到控制台的行,然后我运行setup.py,但操纵杆功能仍然打印输出到控制台。还有我使用Python 2.6和pygame 1.9.1。

But this post does not supply enough information. Because if I have to turn off DEBUG, I would like to know the steps on how to do that. So far I have downloaded the pygame source and went into joystick.c and commented out the lines that print to the console, and then I ran the setup.py, but the joystick functions still print out to the console. Also I am using Python 2.6 and pygame 1.9.1.

推荐答案

这个线程应该解决这个问题:
printf语句1.9.1

This thread should resolve this: printf statements 1.9.1

我有同样的问题,除非在PyScripter下运行它会导致巨大的内存泄漏在PyScripter本身。所以它在我的机器上吃了我的记忆。讨厌的互动。

I had this same issue except when running under PyScripter it causes a huge memory leak in PyScripter itself. So it was eating up all my memory on my machine. Nasty interaction.

这篇关于禁用Pygame控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆