如何在此Pong游戏中添加背景歌曲?在Python3中使用'winsound'库

时间:2019-03-10 15:32:07

标签: python-3.x windows winsound

在此乒乓游戏中,我正在使用python3的“ winsound”库。 当球击中桨时,会发出反弹声。 我还想添加一个.wav文件,以便歌曲可以在整个游戏过程中播放。 我应该在哪里以及如何添加代码行?

这将是代码行:

winsound.PlaySound(“ D:\ Python \ Pong_game_turtle \ one_more_time_daft_punk_8BitUniverse.wav”,winsound.SND_ASYNC)

async def docker_command(command_words):
    return await asyncio.subprocess.create_subprocess_exec(
        *["docker"] + command_words,
        stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT)

async def check_submission(websocket:object, submission:dict):
    exercise = submission["exercise"]
    proc = await docker_command(["exec", "-w", "badkan", "grade_exercise", exercise])
    async for line in proc.stdout:
        print(b"> " + line)
        await websocket.send(line)
    await proc.wait()

0 个答案:

没有答案