Drawing a crescent moon with Python codes

25

  • 10
  • 0
  • 0.030
  • Reply

  • Open in the desktop app ADD TO PLAYLIST

    jimah1k

    Published on Feb 09, 2023
    About :
    Greetings guys,

    i hope everyone is doing great. about last week, i saw contest that really caught my attention and
    im here to particpate in this contest. But before i continue, i want to thank @threespeak for partnering up with @diyhub in organizing this wonderful contest. as some of you know, i love coding so i decided to do something unique by writing a code in python that will draw a cresent moon on my computer. lets head straight into it.

    The first thing you need to do is, call the turtle finction because we will be using it to draw the cresent like shape. we call the turtle function as t by typing "import turtle as t".


    Now after defining the function, its now left with defining the turtle, the background color, the positioning and more. for the background color we can define it with t as in turtle .bg('black'). for the postion of the moon we can center it in the middle for which we can use t.goto(0, 200)


    we are now almost half way through our code, the next thing we need to do it, now define the colour of the moon, which obviously is white. After which we have to set the circle to the middle again with radius of 200

    For thid next part, we are going to repeat or copy the code we already wrote in the begining. copy the code from line 2 to line 8 and paste them in the next line. the are some changes we will make in this codes t.goto(50, -200) becomes the new line 11 and t.color('black') becomes the new line 13
    we end the code with a t.hideturtle(). you can choose to stop here if you want to. but i would advise you import this funtion at the end import turtle;turtle.exitinclick(). this code still keeps the turtle pop up still active unless you click anywhere on the screen to exit it.

    Now run the code. and you should see a full moon which is then later changed to a cresent moon

    i urge each and everyone to try their best to participate in this amazing contest. i would love to read about your thoughts on the code, wethere you would try it out and the results you get. im also open to any question you might have thank you.

    Tags :

    mooncontest coding programming diyhub neoxian ghana contest pob

    Woo! This creator can upvote comments using 3speak's stake today because they are a top performing creator! Leave a quality comment relating to their content and you could receive an upvote worth at least a dollar.

    Their limit for today is $0!
    Comments:
    Time until jimah1k can give away $0 to their commenters.
    0 Days 0 Hours 0 Minutes 0 Seconds
    Reply:

    To comment on this video please connect a HIVE account to your profile: Connect HIVE Account

    More Videos

    00:58
    2 views a year ago $
    05:03
    16 views a year ago $
    02:43
    6 views a year ago $
    00:11
    2 views 5 months ago $
    02:13
    t3a
    15 views 4 years ago $
    01:17
    2 views 8 months ago $