就像标题所暗示的那样,有什么区别吗?我正在使用 pygame.display.flip,我在互联网上看到,而不是使用翻转他们使用pygame.display.update.哪一个更快?
我是python的初学者.我的程序是设置一个数字(我暂时不使用random.randint),我试着猜测它.所以这是代码:
def game():
print "I am thinking of a number between 1 and 10!"
global x
x = 7
y = raw_input("Guess!")
while x > y:
y = raw_input("Too low. Guess again!")
while x < y:
y = raw_input("Too high. Guess again!")
if x == y:
return "You got it! The number was" + x + " !"
Run Code Online (Sandbox Code Playgroud)
但是当我运行时,程序声明x <y,无论我输入的是什么数字.请有人帮助我吗?谢谢.
码:
#!/usr/bin/python
import pygame, time, sys, random, os
from pygame.locals import *
from time import gmtime, strftime
pygame.init()
w = 640
h = 400
screen = pygame.display.set_mode((w, h),RESIZABLE)
clock = pygame.time.Clock()
x = y = 100
def starting():
basicfont = pygame.font.SysFont(None, 48)
text = basicfont.render('Starting...', True, (255, 255, 255), (0, 0, 255))
textrect = text.get_rect()
textrect.centerx = screen.get_rect().centerx
textrect.centery = screen.get_rect().centery
screen.fill((0, 0, 255))
screen.blit(text, textrect)
def taskbar():
basicfont = pygame.font.SysFont(None, 24)
taskbarrect = pygame.Rect((0, int(h-40)), (int(w), int(h)))
text = …Run Code Online (Sandbox Code Playgroud)