📜  如何在pygame中获得左键输入 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:40.857000             🧑  作者: Mango

代码示例1
run = True
while run:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

        if event.type == pygame.MOUSEBUTTONDOWN:
            if event.button == 1:
                print("left mouse button")
            elif event.button == 2:
                print("middle mouse button")
            elif event.button == 3:
                print("right mouse button")
            elif event.button == 4:
                print("mouse wheel up")
            elif event.button == 5:
                print("mouse wheel down")