Форум сайта python.su
0
import math import pygame from pygame.locals import * window = pygame.display.set_mode((600, 600)) pygame.display.set_caption('Hello, pygame!') screen = pygame.Surface((600, 600)) poligon_color = (255, 0, 0) poligon_points = [(200,200),(300,300),(400,150)] poligon_width = 0 ellipse_color = (0,255,0) ellipse_rect = Rect((200,10),(350,150)) ellipse_width = 0 done = True while done: for e in pygame.event.get(): if e.type == pygame.QUIT: done = False screen.fill((50,50,50)) f = open('11.txt', 'r') for line in f: line = line.split(',') x = input(line[0]) if x==rectangle: f.close() pygame.draw.polygon(screen, poligon_color, poligon_points, poligon_width) pygame.draw.ellipse(screen, ellipse_color, ellipse_rect, ellipse_width) window.blit(screen, (0,0)) pygame.display.flip()
f = open('11.txt', 'r') for line in f: line = line.split(',') x = input(line[0]) if x==rectangle: f.close() pygame.draw.polygon(screen, poligon_color, poligon_points, poligon_width)
Офлайн
88
Пользуйтесь нормальной IDE.
Отредактировано Shaman (Фев. 5, 2017 20:11:19)
Прикреплённый файлы:
error1.png (15,9 KБ)
Офлайн
0
ShamanСпасибо поправил if x=='rectangle'
import math
import pygame
from pygame.locals import *
window = pygame.display.set_mode((600, 600))
pygame.display.set_caption('Hello, pygame!')
screen = pygame.Surface((600, 600))
poligon_color = (255, 0, 0)
poligon_points =
poligon_width = 0
ellipse_color = (0,255,0)
ellipse_rect = Rect((200,10),(350,150))
ellipse_width = 0
done = True
while done:
for e in pygame.event.get():
if e.type == pygame.QUIT:
done = False
screen.fill((50,50,50))
f = open('11.txt', ‘r’)
for line in f:
line = line.split(',')
x = input(line)
if x==rectangle:
f.close()
pygame.draw.polygon(screen, poligon_color, poligon_points, poligon_width)
pygame.draw.ellipse(screen, ellipse_color, ellipse_rect, ellipse_width)
window.blit(screen, (0,0))
pygame.display.flip()
Офлайн
88
asdfrНе всё, если быть до конца откровенным. И вообще, в этом г-не слишком мало кода.
и все сразу заработало
Офлайн