pygame draw.rect() 无法绘制颜色

问题描述

我正在尝试为子弹的矩形着色,但由于某种原因颜色没有更新。 red_bullets 和 yellow_bullets 是列表。这是代码

import pygame

red_bullets = []
yellow_bullets = []

RED = (255,0)
YELLOW = (255,255,0)

def draw_window(red_bullets,yellow_bullets):
    for bullet in red_bullets:
        pygame.draw.rect(WIN,RED,bullet)

    for bullet in yellow_bullets:
        pygame.draw.rect(WIN,YELLOW,bullet)
    pygame.display.update()
def main():
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    draw_window(red_bullets,yellow_bullets)

   pygame.quit()

if __name__ == "__main__:
    main()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)