How to suppress console output in Python?

后端 未结 8 1827
北荒
北荒 2020-12-02 22:48

I\'m using Pygame/SDL\'s joystick module to get input from a gamepad. Every time I call its get_hat() method it prints to the console. This is problematic since

8条回答
  •  暖寄归人
    2020-12-02 23:16

    Here's the relevant block of code from joystick.c (via SVN at http://svn.seul.org/viewcvs/viewvc.cgi/trunk/src/joystick.c?view=markup&revision=2652&root=PyGame)

        value = SDL_JoystickGetHat (joy, _index);
    #ifdef DEBUG
        printf("SDL_JoystickGetHat value:%d:\n", value);
    #endif
        if (value & SDL_HAT_UP) {
    

    Looks like a problem with having debugging turned on.

提交回复
热议问题