Drawing Emotions with Python Turtle Module (Smiley Face, Frown, Mad, Sick)

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • Drawing Emotions with Python Turtle Module (Smiley Face, Frown, Mad, Sick). - Use the python turtle module to draw a smiley face, frown face, angry face, or sick face)
    Starting code:
    import turtle #to include the turtle module in your python program
    s=turtle.Screen( ) #create a blank canvas to draw on
    t=turtle.Turtle(shape='turtle') # draw with a turtle shape
    t.color('pencolor', 'fill color') #specify the line color and fill colors
    t.circle(100) #draw a circle with radius 100

Комментарии • 8

  • @Peaceful_Lab
    @Peaceful_Lab 2 месяца назад +1

    thank u

  • @basketcase-qj1mb
    @basketcase-qj1mb Год назад

    Thank you

  • @rhonahdelpasion2964
    @rhonahdelpasion2964 2 года назад +3

    Can u paste here the code?

  • @dreamboxglobal-tech1767
    @dreamboxglobal-tech1767 Год назад +5

    import turtle
    emotion = input('How are you? (s=sad, h=happy, m=mad) ')
    s = turtle.Screen()
    t=turtle.Turtle(shape='turtle')
    t.speed(2)
    t.color('orange', 'yellow')
    if emotion == 'y':
    t.color('orange', 'green')
    elif emotion == 'm':
    t.color('orange', 'red')
    t.begin_fill()
    t.circle(100)
    t.end_fill()
    t.penup()
    t.color('black', 'red')
    #left eye
    t.goto(-30, 135)
    t.pendown()
    t.dot(25)
    t.penup()
    #right eye
    t.goto(30, 135)
    t.pendown()
    t.dot(25)
    t.penup()
    #mouth
    if emotion == 'h':
    t.goto(-60, 60)
    t.pendown()
    t.setheading(-60)
    t.circle(70, 120)
    else:
    t.goto(60, 60)
    t.pendown()
    t.setheading(120)
    t.circle(70, 120)

  • @ItsNKK
    @ItsNKK 2 года назад +1

    Please answer how do you open the app thingy please answer

    • @PainlessProgramming
      @PainlessProgramming  2 года назад

      The IDE (Integrated Development Environment) I am using to create the python program is IDLE. It comes with python when you install.

  • @betterlatethannever4529
    @betterlatethannever4529 2 года назад

    Can/how does one make specific arcs?

    • @MikeRoam2
      @MikeRoam2 2 года назад +1

      t.circle(70, 120) means go from current position and heading for curve of 120 degrees on circle with radius 70. There is example arc for the smile, starting at 6:00 with detailed information about radius and angle at 7:00.