小编J.G*_*Gor的帖子

在 Pygame 中画一条线

我想用 Python 画一条线,但是当我运行下面的代码时,这条线永远不会出现。事实上,我需要用 4x4 部分制作一个字段,但让我们从一行开始。我的代码:

import sys, pygame
from pygame.locals import*

width=1000
height=500
Color_screen=(49,150,100)
Color_line=(255,0,0)

def main():
    screen=pygame.display.set_mode((width,height))
    screen.fill(Color_screen)
    pygame.display.flip()
    pygame.draw.line(screen,Color_line,(60,80),(130,100))
    while True:
        for events in pygame.event.get():
            if events.type == QUIT:

                sys.exit(0)
main()
Run Code Online (Sandbox Code Playgroud)

怎么了?

python pygame

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

标签 统计

pygame ×1

python ×1