+ 2

In Python Turtle graphics, How can I add images ?

Actually I'm working with turtle graphics. I don't know how to insert and PNG image in a turtle graphics. Is there anyone familiar with turtle graphics.

13th May 2018, 5:24 PM
Uday Kiran Jayanthi
Uday Kiran Jayanthi - avatar
7 odpowiedzi
+ 6
hum turtle for simple drawings the canvas might be better suited for your purpose !
13th May 2018, 5:26 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 6
Uday Kiran Jayanthi yes you can but by design it is prevented, that shows the use of turtle @
13th May 2018, 5:41 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 2
actually, I am able to add GIF files, but I want to insert PNG files.
13th May 2018, 5:32 PM
Uday Kiran Jayanthi
Uday Kiran Jayanthi - avatar
+ 2
you can convert a png into a gif file without quality loss
13th May 2018, 5:39 PM
hinanawi
hinanawi - avatar
+ 2
If you're using pure python without any additional external libraries you'll need to convert to a Gif. Otherwise, you can use PIL for python 2 or Pillow for python 3. You'll need to install the library to your python installation or virtual environment. Then you can import it and use Image.open('picture.png') etc to load a png image instead of just using a Gif. Just Google 'python pillow' or 'pil'
13th May 2018, 6:44 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You need to convert the PNG to a gif and then you can add it.
13th May 2018, 5:50 PM
Paul Grasser
Paul Grasser - avatar
0
go to turtle documentation in the python docs....
14th May 2018, 5:47 AM
Suhail Ahmad
Suhail Ahmad - avatar