使用pyGame在Sublime Text 3中打印问题?

时间:2017-03-05 19:45:06

标签: python printing pygame sublimetext3

我使用Sublime Text 3作为我的Python IDE和Python使用pyGame库。

问题是,当我将鼠标光标移出或移入pyGame窗口时,鼠标才会更新。我通过将光标移入和移出窗口几次来测试它。

我该如何解决这个问题?

谢谢。

# Import pyGame
import pygame
import time

# Create the game window.
pygameInit = pygame.init()

if pygameInit[1] != 0:
    raise valueError

gameDisplay = pygame.display.set_mode((800, 600))
# Name the game window.
pygame.display.set_caption("Spooky action at a distance")

update = pygame.display.update()

cycles = 0
gameExit = False
while gameExit == False:
    mouseMoved = False
    events = pygame.event.get()
    start = time.time()
    for event in events:
        if event.type == pygame.MOUSEMOTION:
            mouseEvent = event
        else:
            print(event)

        if event.type == pygame.MOUSEMOTION:
            mouseMoved = True
    if mouseMoved == True:
        start = time.time()
    else:
        end = time.time()
        elapsed = end - start

        if elapsed > 0.1:
            print(mouseEvent)

    if mouseMoved == True:
        mouseMoved = False


cycles += 1

pygame.quit()
quit()

0 个答案:

没有答案