import turtle
turtle.tracer(0,0)
class punkt(object):
def __init__(self,x,y):
self.__x=x
self.__y=y
def getxy(self):
return(self.__x,self.__y)
def draw(self,skala,dx,dy,nazwa):
turtle.speed(0)
turtle.up()
turtle.goto((self.__x-dx)*skala,(self.__y-dy)*skala)
turtle.dot()
if nazwa != 0:
turtle.write(str(self.__x)+", "+str(self.__y))
def kwadrat(x1,y1,x2,y2):
turtle.up()
turtle.goto(x1,y1)
turtle.down()
turtle.goto(x2,y1)
turtle.goto(x2,y2)
turtle.goto(x1,y2)
turtle.goto(x1,y1)
turtle.up()
return 0
turtle.up()
plik = open("C:\Users\user\Downloads\punkty.txt","r")
xmin = 1000000.0
xmax = -10000000.0
ymin = 1000000.0
ymax = -1000000.0
punkty = []
for i in plik:
wiersz = i.split()
punkty.append(punkt(float(wiersz[0]),float(wiersz[1])))
x = float(wiersz[0])
y = float(wiersz[1])
if x<xmin:
xmin = x
if x>xmax:
xmax = x
if y<ymin:
ymin = y
if y>ymax:
ymax = y
w = ymax-ymin
sz = xmax-xmin
px = (xmin+xmax)/2
py = (ymin+ymax)/2
turtle.up()
turtle.goto((xmin-px)*100,(ymin-py)*100)
turtle.down()
turtle.goto((xmin-px)*100,(ymin+w-py)*100)
turtle.goto((xmax-px)*100,(ymax-py)*100)
turtle.goto((xmax-px)*100,(ymax-w-py)*100)
turtle.goto((xmin-px)*100,(ymin-py)*100)
xsr = (xmin+xmax)/2
ysr = (ymin+ymin)/2
if w>sz:
a = (w-sz)/2
kwadrat((xmax-px)*100,(ymax-py+a)*100,(xmin-px)*100,(ymin-py-a)*100)
kwadrat(x
elif w<sz:
a = (sz-w)/2
kwadrat((xmax-px+a)*100,(ymax-py)*100,(xmin-px-a)*100,(ymin-py)*100)
else:
kwadrat(xmax,ymax,xmin,ymin)
for i in punkty:
i.draw(100,px,py,0)
plik.close()
turtle.done()
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}