Ahojte potrebovala by som pomôcť s grafikou v pythone keď napíšem daný kód:
import Image
import math
def demo1():
im = Image.new("RGB", (20,20), (255,255,255))
r = 5
t = 360
for i in range(t):
x = int(r*(t - math.sin(math.radians(t))))
y = int(r*(1 - math.cos(math.radians(t))))
im.putpixel((x,y), (100,255,105))
im.show()
im.save("demo.png")
demo1()
Vypíše to nasledujúcu hlášku:
Traceback (most recent call last):
File "C:/Python27/cykloidy.py", line 16, in <module>
demo1()
File "C:/Python27/cykloidy.py", line 12, in demo1
im.putpixel((x,y), (100,255,105))
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1267, in putpixel
return self.im.putpixel(xy, value)
IndexError: image index out of range
Za radu vopred ďakujem.