You need to call the function
If the window closes is because you need to call done() at the end
You can check a tutorial so you get an example of a minimal program.
In the documentation of done() you will see it says:
Must be the last statement in a turtle graphics program. Must not be
used if a script is run from within IDLE in -n mode (No subprocess) -
for interactive use of turtle graphics.
from turtle import *
player = turtle.Turtle()
player.color("lime")
player.speed(1)
def makeShape (NumSides):
for i in range (NumSides):
player.forward(100)
player.left(360.0/NumSides)
# here you need to call the function and pass the number of sides you want
# example to make a square
makeShape(4)
done()