赞
踩
import sys
import pygame
pygame.init()
draw_x = 100
draw_y = 100
draw_width = 300
draw_height = 300
draw_color = 60, 60, 60
self = pygame.Rect(draw_x, draw_y, draw_width, draw_height)#已屏幕左上角为坐标原点
screen_width = 1000
screen_height = 700
screen_color = (230,230,230)
screen = pygame.display.set_mode((screen_width,screen_height))
while True:
screen.fill(screen_color)
pygame.draw.rect(screen,draw_color,self)
pygame.display.flip()
for event in pygame.event.get():
if event.type == pygame.QUIT: # 如果点窗口关闭按钮,检测pygam.QUIT
sys.exit() # 游戏退出
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。