How to create graphics using Python turtle 🐍🐢

Поділитися
Вставка
  • Опубліковано 23 сер 2022
  • This tutorial will create colorful graphics using the python turtle library.
    Let's have some fun by making some excellent graphics in python turtle.
    Related Tags
    python turtle graphics tutorial,
    python turtle tutorial,
    python turtle animation,
    python turtle projects,
    python turtle graphics animation,
    python turtle art,
    python turtle basics,
    python turtle beginner,
    python turtle cool designs
    Hashtags
    #python #graphics #programming #pythonturtle #turtle #coolgraphics #python #gui #coding #trending
    Learn python coding and programming for beginners. Here you will also learn to build small projects and scripts that will help you excel in your python programming skills.
    Let's build some cool things and have fun with python coding.
    This Channel will show you that you don’t have to be an expert computer programmer in order to start using programming languages!
    Python is a high-level programming language that is used in many different fields.

КОМЕНТАРІ • 255

  • @sivaraman8442
    @sivaraman8442 Рік тому +198

    import turtle
    import colorsys
    t = turtle.Turtle()
    s = turtle.Screen().bgcolor('black')
    t.speed(0)
    n = 70
    h = 0
    for i in range(360):
    c = colorsys.hsv_to_rgb(h, 1, 0.8)
    h+= 1/n
    t.color(c)
    t.left(1)
    t.fd(1)
    for j in range(2):
    t.left(2)
    t.circle(100)

    • @feepants4495
      @feepants4495 Рік тому +2

      error

    • @sougatamandal8519
      @sougatamandal8519 11 місяців тому +2

      mistake is = t = turtle.Turtle()

    • @Area_58
      @Area_58 11 місяців тому +12

      Import turtle
      Import colorsys
      t=turtle.Turtle()
      s=turtle.Screen().bgcolor('black')
      t.speed(0)
      n = 70
      h = 0
      for i in range(360)
      c = colorsys.hsv_to_rgb(h, 1, 0.8)
      h+= 1/n
      t.color(c)
      t.left(1)
      t.fd(1)
      for j in range(2):
      t.left(2)
      t.circle(100)

    • @password6975
      @password6975 3 місяці тому

      🙏

    • @Sanjay54157
      @Sanjay54157 3 місяці тому

      super bro

  • @TheTalkingCatNL
    @TheTalkingCatNL Рік тому +69

    These are easy and cool tutorials for beginners.

  • @feepants4495
    @feepants4495 Рік тому +22

    Here's the code that worked for me!
    import turtle
    import colorsys
    t = turtle.Turtle()
    s = turtle.Screen().bgcolor('black')
    t.speed(0)
    n = 70
    h = 0
    for i in range(360):
    c = colorsys.hsv_to_rgb(h, 1, 0.8)
    h+= 1/n
    t.color(c)
    t.left(1)
    t.fd(1)
    for j in range(2):
    t.left(2)
    t.circle(100)

    • @sunilkumar33366
      @sunilkumar33366 10 місяців тому

      Bro this doesn't work my mobile 😅

    • @renukaagrawal1081
      @renukaagrawal1081 8 місяців тому +1

      How we run this code

    • @feepants4495
      @feepants4495 8 місяців тому +1

      @@renukaagrawal1081 What?

    • @Mr.Hacker141
      @Mr.Hacker141 6 місяців тому +1

      I think she means the place where you type your code

    • @markff6366
      @markff6366 5 місяців тому

      IDLE​@@Mr.Hacker141

  • @Cuber1771
    @Cuber1771 6 місяців тому +51

    For anyone having an AttributeError, I have a solution.
    If it’s in line 3, capitalize the t at the start of the second turtle like this:
    t = turtle.Turtle() and make sure to put the parenthesis’s at the end
    If it’s in line 4, there’s two possibilities. First, u forgot the parenthesis after screen
    Second, u didn’t capitalize the S in screen.
    Line 4 should be:
    s = turtle.Screen().bgcolor(‘black’)
    Hope that helped!
    If u have any other problems send the error message and I will try to help

    • @yeji.27060
      @yeji.27060 4 місяці тому +1

      I have error in 8th line
      for i in range (360)

    • @Cuber1771
      @Cuber1771 4 місяці тому

      @@yeji.27060 remove the space before the parenthesis and make sure to put the colon at the end

    • @user-xl8lf1tt1c
      @user-xl8lf1tt1c 4 місяці тому

      Just look

    • @Cuber1771
      @Cuber1771 4 місяці тому +2

      @@yeji.27060 remove the space between range and (360) and put a colon at the end. Should look like for i in range(360):

    • @rockyroadtv2547
      @rockyroadtv2547 4 місяці тому

      I have error in line 4 says that s is not defined

  • @PuppyPinky
    @PuppyPinky 2 місяці тому +3

    Pls tell how to stop it??

  • @AllThingsAviationOfficial
    @AllThingsAviationOfficial Місяць тому

    Saved this as a .py file, looks amazing :D

  • @Cherry-gf6ow
    @Cherry-gf6ow 11 місяців тому +9

    Bro this is amazing😍

  • @luckyluke_065
    @luckyluke_065 Місяць тому

    Which software you use for output

  • @rockyroadtv2547
    @rockyroadtv2547 4 місяці тому

    Amazing bro now I found my bug finally working

  • @user-ij8rq3qg6o
    @user-ij8rq3qg6o 6 місяців тому +1

    Pls give details on how u did it

  • @nikabhallu
    @nikabhallu 11 місяців тому +1

    can you help me , i am running pythons on mac hut whenever I try any command with python its show killed". eg : python3 --version
    [1] killed 1427 python3 --version

  • @hiifukjg
    @hiifukjg 9 місяців тому +2

    thaks worked 👍👍👍👍

  • @ShakhzodUmarrov
    @ShakhzodUmarrov 9 місяців тому +2

    How to run main

  • @jesseclutterbuck6617
    @jesseclutterbuck6617 Рік тому +5

    awsome work buddy. Id love to see more
    graphical stuff with python. maybe a graphical ui next ? 😊😊😊

    • @VerloreneErinnerung
      @VerloreneErinnerung Рік тому

      That's cool and stuff, but has nothing to do with Turtle module

  • @Techno-Beats2565
    @Techno-Beats2565 8 місяців тому

    It was cool but when I used it it gave me another shape but that was cool to!

  • @user-xw9ye9pp2n
    @user-xw9ye9pp2n 5 місяців тому

    This is amazing ❤

  • @Triplle..m
    @Triplle..m 4 місяці тому

    thanks man ,,,i was trying to figure out what was wrong

  • @anoshijaz
    @anoshijaz 9 місяців тому +1

    You can increase size of multi colour ball by increasing t.circle(100) value

  • @nitishxess3616
    @nitishxess3616 Рік тому +1

    How to fix installation problem of colorsys
    Can you help me

  • @ellissb8574
    @ellissb8574 Рік тому +3

    very nice😍😍😍😍

  • @samwi53_0
    @samwi53_0 Рік тому +5

    Doesn't Turtle already accept RGB values, why did we have to import the second module / library 'colorsys' ?

    • @NO992
      @NO992 Рік тому +1

      He used colorsys to change color easily, using hsv values.

    • @samwi53_0
      @samwi53_0 Рік тому

      @@NO992 *oh* that makes sense

  • @eternaldivine47
    @eternaldivine47 5 місяців тому +1

    Damn bro ⚡ its working tell us more with video how you learn this

  • @PikapikaAkira
    @PikapikaAkira 2 місяці тому

    It's satifing

  • @user-oi4sl1bp7c
    @user-oi4sl1bp7c 11 місяців тому

    tell me how to make it faster, what part of the code do i change

  • @shrikanttalekar
    @shrikanttalekar Місяць тому

    On which app we I'll insert this code

  • @sidd3987
    @sidd3987 4 місяці тому

    You can also change circles size in the last line, t.circle(250) is the maximum size in my computer

  • @VKB__12
    @VKB__12 Місяць тому

    I did it🎉

  • @molicheng
    @molicheng Рік тому +1

    how to stop it

  • @FLUX07
    @FLUX07 10 місяців тому

    FUIYOH, Nice

  • @saikumarpappy3640
    @saikumarpappy3640 4 місяці тому

    How to install the graphic application plss say me

  • @user-ps8ww6dw7h
    @user-ps8ww6dw7h 9 місяців тому

    Worked 👍

  • @technicianpowerelectronics2755
    @technicianpowerelectronics2755 8 місяців тому

    Superb 🎉

  • @03yashahire19
    @03yashahire19 10 місяців тому +1

    Nice

  • @thetlmg
    @thetlmg Рік тому +1

    i dont even need the code and i can do it lol

  • @coinbg
    @coinbg 7 місяців тому

    what do i do if my turtle windows is not responding

  • @rs_gaming_og9210
    @rs_gaming_og9210 Місяць тому

    Thanks

  • @tanmaybpsri
    @tanmaybpsri Місяць тому

    Which vergion is this

  • @igu642
    @igu642 8 місяців тому

    ithing using python like using inbuilded functions from library

  • @d116s
    @d116s 5 місяців тому

    Bro I did it 🤩

  • @Kakaraparthisandeep
    @Kakaraparthisandeep 17 днів тому

    Shall it happens on phone

  • @shamai1099
    @shamai1099 8 місяців тому

    What for about performance?)

  • @gigasheeep
    @gigasheeep 6 місяців тому

    How to export them as mp4 videos

  • @UnFanDeDoom9
    @UnFanDeDoom9 2 місяці тому +1

    En qué te sirve eso

  • @jshet
    @jshet Рік тому +3

    Slow down

  • @owniiee1238
    @owniiee1238 Місяць тому

    Can anyone tell where to type this I have install python 3.7.9 and I have type there but I don't know how to run it 😢😅

  • @celineguler
    @celineguler 8 місяців тому

    why doesn't it work on colab?

  • @XadichaUbaydullayeva
    @XadichaUbaydullayeva Рік тому

    Wow🎉😮

  • @adarshrd5262
    @adarshrd5262 Рік тому

    where to do this ?????

  • @user-qb8jj3cy9s
    @user-qb8jj3cy9s 7 днів тому

    Is it possible in mobile.......In kaggle website 😊😊😊

  • @anonymous-65732
    @anonymous-65732 3 місяці тому

    witch browser design

  • @vstechiegamer5996lol
    @vstechiegamer5996lol Рік тому +2

    I am not able to install colorsys via "pip install colorsys". It says ,"ERROR: Could not find a version that satisfies the requirement colorsys (from versions: none)
    ERROR: No matching distribution found for colorsys" in the terminal.

    • @SuperMarioGalaxySMG
      @SuperMarioGalaxySMG 10 місяців тому

      sometimes the pip install has more to it than just pip install and the name, google it if u havent already

  • @syedusamabinsabir5307
    @syedusamabinsabir5307 4 дні тому

    Should we learn these codes or not
    Ps: I'm noob

  • @BekBek-my2ru
    @BekBek-my2ru 2 місяці тому +1

    import math
    from turtle import *
    def hearta(k) :
    return 15*math.sin(k)**3
    def heartb(k) :
    return 12*math.cos(k)-5*\
    math.cos(2*k)-2*\
    math.cos(3*k)-\
    math.cos(4+k)
    speed(1000)
    bgcolor("black")
    for i in range(6000):
    goto(hearta(i)*20,heartb(i)*20)
    for j in range(5):
    color("#f73487")
    goto(0,0)
    done()

  • @yashyadav7816
    @yashyadav7816 Рік тому +1

    Name error showing

  • @yashyadav7816
    @yashyadav7816 10 місяців тому

    Waht is use of h+=1/n

  • @coinbg
    @coinbg 7 місяців тому

    was this on IDLE or smthng else

  • @tuibchjvcgjvcgjkbvcuiibvhjvbj
    @tuibchjvcgjvcgjkbvcuiibvhjvbj 7 місяців тому

    Hiw to draw this my turtlr only moving turtle

  • @sriviswanatha3437
    @sriviswanatha3437 6 місяців тому

    If i am doing in programiz i am getting indentation error can any one solve this

  • @lkfactsworld8155
    @lkfactsworld8155 4 місяці тому +1

    But bro i am getting line 1 error

    • @SashoSuper
      @SashoSuper 3 місяці тому

      turtle = turtle.Turtle is supposed to have () at the end.

  • @Naksh_Patil.555
    @Naksh_Patil.555 Місяць тому

    Working write attentively.

  • @varietycrafts6772
    @varietycrafts6772 5 днів тому +2

    THIS WORKS IN PYTHON IDE SHELL
    import turtle
    import colorsys
    t = turtle.Turtle()
    s = turtle.Screen().bgcolor('black')
    t.speed(0)
    n = 70
    h = 0
    for i in range (360):
    c = colorsys.hsv_to_rgb(h, 1, 0.8)
    h+= 1/n
    t.color(c)
    t.left(1)
    t.fd(1)
    for j in range(2):
    t.left(2)
    t.circle(100)

  • @Faizi971
    @Faizi971 5 місяців тому +1

    Plz tell me this app name

  • @GabYburanz
    @GabYburanz 11 місяців тому

    does it crash your pc?

  • @ARTIDESIGLAM
    @ARTIDESIGLAM 8 місяців тому

    Phone ma run nehey ho raha sir

  • @Jaihindfitness-v3z
    @Jaihindfitness-v3z 9 днів тому

    Bro this code print a only circle in red color

  • @youtubeaccount1718
    @youtubeaccount1718 Рік тому +10

    import colorsys
    import turtle
    t = turtle.Turtle() # Add parentheses after turtle.Turtle
    s = turtle.Screen().bgcolor('black')
    t.speed(0)
    n = 70.0 # Use a float value for smoother color transitions
    h = 0
    for i in range(360):
    c = colorsys.hsv_to_rgb(h, 1, 0.8)
    h += 1/n
    t.color(c)
    t.left(1)
    t.fd(1)
    for j in range(2):
    t.left(2)
    t.circle(100)

  • @D_vlogs_official.
    @D_vlogs_official. 5 місяців тому +1

    import colorsys t = turtle.Turtle() s = turtle.Screen().bgcolor('black') t.speed(0) n = 70 Like h = 0 for i in range (360): c = colorsys.hsv_to_rgb(h, 1, 0.8 h+= 1/n Dislike t.color(c) t.left(1) t.fd(1) for j in range (2): 256 t.left(2) t.circle(100)

  • @DK_CODING
    @DK_CODING 6 місяців тому

    Line 4 in module error show h = 0

  • @standard2104
    @standard2104 4 місяці тому

    song name?

  • @pareetachheda7982
    @pareetachheda7982 8 місяців тому

    😢so fast 🤧

  • @mollypatten5462
    @mollypatten5462 3 місяці тому

    I got an error on line 9

  • @ravindramadhheshiya
    @ravindramadhheshiya Рік тому

    Apna Jo coding karka program banaya hai main jab apka program bana ka Kiya to kuch dusra show ho raha hai

  • @saidabbosxonqambarov8922
    @saidabbosxonqambarov8922 Рік тому +58

    import turtle
    import colorsys
    t = turtle.Turtle
    s = turtle.Screen().bgcolor('black')
    t.speed(0)
    n = 70
    h = 0
    for i in range(360):
    c = colorsys.hsv_to_rgb(h, 1, 0.8)
    h+= 1/n
    t.color(c)
    t.left(1)
    t.fd(1)
    for j in range(2):
    t.left(2)
    t.circle(10)
    free copy ;)
    but gives AttributeError: 'int' object has no attribute '_speed'

  • @user-cn6sj7zl4q
    @user-cn6sj7zl4q 4 місяці тому

    Dahshat

  • @Gangotri_yatra
    @Gangotri_yatra 6 місяців тому +1

    AttributeError at line 2 of your code: module 'turtle' has no attribute 'screen'

    • @Cuber1771
      @Cuber1771 6 місяців тому

      Make sure you have Screen capitalized. Line 2 should be:
      turtle.Screen()bgcolor(‘black’)
      From what I can tell the problem is that the S in Screen isn’t capital
      P.S. that is actually line 4, the imports count as lines just a tip

  • @nirmikasethfreeeducation6201
    @nirmikasethfreeeducation6201 6 місяців тому +1

    Which bersion is this please tell

    • @funwithpython8618
      @funwithpython8618  6 місяців тому

      Hey, you can install the latest version of python

  • @Artist-Hariom613
    @Artist-Hariom613 9 днів тому

    import turtle
    import colorsys
    t = turtle. Turtle()
    s = turtle. screen(). bgcolor('black')
    t. speed(0)
    n = 70
    h = 0
    for I in range (360):
    C = coloursys. hsv. to. rgb(h,1,0.8)
    h+= 1/n
    t. colour(c)
    t. left(1)
    for j in range (2):
    t. left(2)
    t. circle(10)

  • @Sans________________________96
    @Sans________________________96 2 місяці тому

    Hi

  • @laluuvlogs
    @laluuvlogs Рік тому +2

    I manixs

  • @jesusleguizamon6566
    @jesusleguizamon6566 10 місяців тому +2

    Hi sir, is there some options for make animations with python for some file glb and then save to mp4? Regards

  • @aghora3845
    @aghora3845 Рік тому +2

    why it is not working????

    • @feepants4495
      @feepants4495 Рік тому

      Code is:
      import turtle
      import colorsys
      t = turtle.Turtle()
      s = turtle.Screen().bgcolor('black')
      t.speed(0)
      n = 70
      h = 0
      for i in range(360):
      c = colorsys.hsv_to_rgb(h, 1, 0.8)
      h+= 1/n
      t.color(c)
      t.left(1)
      t.fd(1)
      for j in range(2):
      t.left(2)
      t.circle(100)

  • @karolzdziech8828
    @karolzdziech8828 6 місяців тому

    Poland

  • @maninderbansal8560
    @maninderbansal8560 22 дні тому

    NameEror: name 'h' is not defined
    C=colorsys.hsv_to_rgb(h, 1, 0.8)

  • @Gangotri_yatra
    @Gangotri_yatra 6 місяців тому +1

    NameError at line 2 of your code: name 'turtle' is not defined

    • @Cuber1771
      @Cuber1771 6 місяців тому

      On the first line, t = turtle.Turtle() make sure to capitalize the second turtle like I have. Hope that helped
      P.S. the imports count as lines so that should be line 4
      Edit: just realized that may not be correct, so if it doesn’t work, make sure that u have the turtle module installed, can be done with pip install turtle in the terminal

  • @devipriyakannan2856
    @devipriyakannan2856 2 місяці тому +3

    Guys, to stop it at exactly one rotation is to change the "I in range" from (360) to (72). Hope it helped 🎉😊

  • @Mr.Hacker141
    @Mr.Hacker141 6 місяців тому

    It keeps telling me that there is a syntax error on line 8 which is 'for i in range(360)'

    • @Cuber1771
      @Cuber1771 5 місяців тому

      Make sure u put the colon at the end and it should work

  • @Mr.Hacker141
    @Mr.Hacker141 6 місяців тому

    Guys where did you type this code??

  • @Sanjidgamingff
    @Sanjidgamingff 8 місяців тому

    It isn't this work for phone 😢😢😢

  • @logaboi731
    @logaboi731 Рік тому +2

    "Pythin turtle"💀

  • @xxtrordinaryribbit5257
    @xxtrordinaryribbit5257 6 місяців тому

    And I thought
    print ( 1 + 1)
    Was cool 😅

  • @mohitvarade2482
    @mohitvarade2482 Рік тому

    Can u provide me code for "love u bewdi"

  • @buddhikapeiris8794
    @buddhikapeiris8794 5 місяців тому

    😢 it didn't work for me 😢

  • @user-ho1kn3mm4x
    @user-ho1kn3mm4x Рік тому

    bhoot

  • @user-zg1se7xk5v
    @user-zg1se7xk5v Рік тому

    which app are you using for this code

  • @medjugoracmarko007
    @medjugoracmarko007 Рік тому +1

    How to reset it?

    • @funwithpython8618
      @funwithpython8618  Рік тому

      You can restart the kernel and clear output if you are running the code in the jupyter notebook

  • @Azbiz133
    @Azbiz133 Рік тому

    What is the iterepter😅

  • @techaditya256
    @techaditya256 Рік тому +1

    This video is speed

  • @debanjanadey5522
    @debanjanadey5522 Рік тому +19

    why did you made it so long the exact same thing can be done by this code too
    import turtle
    t= turtle.Turtle()
    s= turtle.Screen().bgcolor('black')
    t.speed(0)
    for i in range (360):
    t.color('yellow')
    t.left(1)
    t.fd(1)
    for j in range (2):
    t.left(2)
    t.circle(100)
    and this one is shorter than yours

    • @zakidz6716
      @zakidz6716 Рік тому +11

      this also could be shortened to
      from turtle import *
      bgcolor('black')
      color('yellow')
      speed(0)
      for i in range (120):
      lt(3)
      fd(1)
      circle(100)
      done()

    • @Anushka-ng5qn
      @Anushka-ng5qn Рік тому

      Zakids u are correct

    • @__8120
      @__8120 7 місяців тому

      Yeah but neither of these actually change color

    • @xenomcz8419
      @xenomcz8419 5 місяців тому

      I now have urge to come up with some cursed one liner that does this

  • @GAMEREVIEW445
    @GAMEREVIEW445 9 місяців тому

    i can't run it guys it's line 5 the problem is line 5
    i need help

    • @Cuber1771
      @Cuber1771 6 місяців тому

      Seeing the error message would help, but it is most likely because you forgot to capitalize something. Make sure that the second turtle in turtle.Turtle() is capitalized and everything is spelled right. Otherwise send the error message and I can try to help

  • @ThefirstEyup
    @ThefirstEyup Рік тому

    how can i save it (like .mp4)

    • @Bended
      @Bended Рік тому

      screen record