1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] trinket.io TypeError "unexpected keyword argument 'shape'"

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to move pieces of a high school comp sci project to trinket and I keep getting the following error:

    TypeError: <native JS>() got an unexpected keyword argument 'shape' on line __ in main.py


    Here's the link to the full code: https://trinket.io/python/cd9569bd2760

    Example error:

    TypeError: <native JS>() got an unexpected keyword argument 'shape' on line 98 in main.py


    The block below includes lines 95 to 101. The shape keyword keeps giving me trouble.

    elif rand_index == 2:
    wn.addshape(turtle_image)
    print("Your new friend is a turtle!")
    animal = trtl.Turtle(shape = turtle_image)
    animal.penup()
    favorite_food = "fruit.gif"
    wn.update() # Show the graphics


    I've defined turtle_image in the following block:

    #---image initialization---
    axolotl_image = "axolotl2.gif"
    blobfish_image = "blobfish.gif"
    dolphin_image = "dolphin.gif"
    elephant_image = "elephant.gif"
    ferret_image = "ferret.gif"
    panda_image = "Red_panda.gif"
    tiger_image = "tiger.gif"
    turtle_image = "turtle.gif"
    whale_image = "whale.gif"
    wolf_image = "wolf.gif"


    The code is supposed to display the matching image when an animal's number gets picked from the rand_index command.

    Continue reading...

Compartilhe esta Página