小编Yub*_*Lee的帖子

pygame.display.update和pygame.display.flip之间的区别

就像标题所暗示的那样,有什么区别吗?我正在使用 pygame.display.flip,我在互联网上看到,而不是使用翻转他们使用pygame.display.update.哪一个更快?

pygame python-2.7

23
推荐指数
2
解决办法
2万
查看次数

Python while语句错误

我是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,无论我输入的是什么数字.请有人帮助我吗?谢谢.

python while-loop python-2.7

2
推荐指数
1
解决办法
129
查看次数

pygame创建曲面

码:

#!/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)

python pygame python-2.7 pygame-surface

0
推荐指数
1
解决办法
9102
查看次数

标签 统计

python-2.7 ×3

pygame ×2

python ×2

pygame-surface ×1

while-loop ×1