# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import time
import airsim
# 公众号:一行数据
import pygame
import sys
import math
from pygame.locals import *
def draw_point():
pygame.init()
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLUE = (0, 0, 255)
points = [(200, 175), (300, 125), (400, 175), (450, 125), (450, 225), (400, 175), (300, 225)]
size = width, height = 640, 1000
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Python Demo")
clock = pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
screen.fill(WHITE)
pygame.draw.rect(screen, BLACK, (50, 30, 150, 50), 0)
pygame.draw.rect(screen, BLACK, (250, 30, 150, 50), 1)
pygame.draw.rect(screen, BLACK, (450, 30, 150, 50), 10)
pygame.draw.polygon(screen, GREEN, points, 0)
pygame.draw.circle(screen, RED, (320, 400), 25, 1)
pygame.draw.circle(screen, GREEN, (320, 400), 75, 1)
pygame.draw.circle(screen, BLUE, (320, 400), 125, 1)
pygame.draw.ellipse(screen, BLACK, (100, 600, 440, 100), 1)
pygame.draw.ellipse(screen, BLACK, (220, 550, 200, 200), 1)
pygame.draw.arc(screen, BLACK, (100, 800, 440, 100), 0, math.pi, 1)
pygame.draw.arc(screen, BLACK, (220, 750, 200, 200), math.pi, math.pi * 2, 1)
pygame.display.flip()
clock.tick(10)
def draw_circle(points):
pygame.init()
screen = pygame.display.set_mode((320, 240))
pygame.display.set_caption('keyboard ctrl @FPV')
screen.fill((0, 0, 0))
# points = [(120, 100), (125, 100),(130, 100),(135, 100)]
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
# draw_point()
pygame.init()
screen = pygame.display.set_mode((320, 240))
pygame.display.set_caption('keyboard ctrl @FPV')
screen.fill((0, 0, 0))
# points = [(120, 100), (125, 100),(130, 100),(135, 100)]
points = []
x = 120
y = 100
while True:
x += 5
points.append((x, y))
# for i in points:
# 利用pygame库加载保存的第一视角图像,
screen_image = pygame.image.load("1.png")
# 图像坐标系,左上角为(0, 0),在此放置图片
screen.blit(screen_image, (0, 0))
for i in points:
pygame.draw.circle(screen, (255, 0, 0), i, 2, 0)
pygame.display.flip()
pygame.display.update()
time.sleep(1)
print('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
pygame画图
最新推荐文章于 2024-07-07 10:30:19 发布