我的代码示例结果只是一个黑屏,我不知道为什么。我在windows7上用python2.7、pygame和easygui运行这个程序。在import pygame, easygui, io, time
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
PINK = (255, 0, 255)
PURPLE = (130, 0, 130)
programMode = 0
class TextPrint:
def __init__(self):
self.reset()
self.font = pygame.font.Font(None, 20)
def printline(self, screen, textString):
textBitmap = self.font.render(textString, True, WHITE)
screen.blit(textBitmap, [self.x, self.y])
self.y += self.line_height
def printDebugLine(self, screen, textString):
textBitmap = self.font.render(textString, True, RED)
screen.blit(textBitmap, [self.debugX, self.debugY])
self.debugY += self.debugLineHeight
def reset(self):
self.x = 600
self.debugX = 600
self.y = 400
self.debugY = 400
self.line_height = 15
self.debugLineHeight = 13
def indent(self):
self.x += 10
def unindent(self):
self.x -= 10
pygam