pythonpython-3.xpygame

How do I disable the "Hello from the pygame community" terminal alert while using pygame?


Every time I run a pygame script, I get an annoying alert in terminal saying:

Hello from the pygame community. https://www.pygame.org/contribute.html

How do I disable this?


Solution

  • Modifying the library would mean that you would have to modify the library everywhere you ship your code, and is generally not a good idea.

    The upcoming release 1.9.5 of pygame will include an option to turn off the message without modifying the library:

    You have to set the environment variable PYGAME_HIDE_SUPPORT_PROMPT to any value.

    On Windows: set PYGAME_HIDE_SUPPORT_PROMPT=1

    On Linux etc.: export PYGAME_HIDE_SUPPORT_PROMPT=1

    Or even in your code:

    from os import environ
    environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
    
    import pygame  # it is important to import pygame after that