Eid Mubarak greeting card
This code uses the Turtle graphics library to draw a simple Eid Mubarak greeting card. The main elements of the card are a black circle and a gold star on top of it, with several smaller gold stars scattered randomly around the card.
Eid Mubarak greeting card
import turtle as timport random as rt.speed(10)def star():t.left(90)t.forward(90)t.pencolor("#d4ad4c")t.begin_fill()for _ in range(5):t.color("#d4ad4c")t.forward(51)t.left(144)t.end_fill()t.pen(pensize=5,pencolor="#d4ad4c")t.bgcolor("#000000")t.up()t.goto(-50,15)t.down()t.begin_fill()t.color('#d4ad4c')t.circle(120)t.end_fill()t.up()t.goto(-20,25)t.down()t.begin_fill()t.color('#000000')t.circle(120)t.end_fill()star()for _ in range(20):l=r.randint(5,12)x=r.randint(-610,650)y=r.randint(-350,350)t.up()t.goto(x,y)t.down()t.begin_fill()for _ in range(5):t.color('#d4ad4c')t.forward(1)t.left(144)t.end_fill()def write(message,pos,color):x,y=post.color(color)t.penup()t.goto(x,y)t.pendown()style=('Courier',40,"italic")t.write(message,font=style)write("EID",(80,25),"#d4ad4c")write("MUBARAK",(25,-25),"#d4ad4c")t.done()
- Upon executing the aforementioned command, a new window will open and the program will begin to draw Tony Stark. The completed drawing of Eid Mubarak greeting card can be seen below.
- To run this code on your pc/laptop, you can follow these steps:
Open a Python IDE or code editor on your computer. Examples of popular IDEs include PyCharm, Spyder, and VSCode.
Copy the code and paste it into a new Python file in your IDE.
Save the file with a name of your choice, such as "EidMubarakCard.py". Make sure to save the file with a ".py" extension to indicate that it is a Python file.
Run the code by clicking the "Run" button in your IDE or by pressing the "F5" key on your keyboard. This will execute the code and display the output in a new window.
If everything is working correctly, you should see a Turtle graphics window appear, displaying the Eid Mubarak card. The card consists of a black circle with a gold circle on top of it, a gold star on top of the gold circle, and several small gold stars scattered around the card. The text "EID" and "MUBARAK" should also be displayed in gold color on the card.
Close the window when you are finished viewing the card.
- To run this code on a mobile device, you can use a Python code editor app that supports Turtle graphics. Here's an example of how to run the code using the "Pydroid 3" app for Android:
Install the Pydroid 3 app from the Google Play Store or the App Store.
Open the app and create a new Python file by tapping the "New file" icon in the top-left corner of the screen.
Copy the code and paste it into the new file in the Pydroid 3 app.
Save the file with a name of your choice, such as "EidMubarakCard.py". Make sure to save the file with a ".py" extension to indicate that it is a Python file.
Run the code by tapping the "Run" button in the top-right corner of the screen. This will execute the code and display the output in a new window.
If everything is working correctly, you should see a Turtle graphics window appear, displaying the Eid Mubarak card. The card consists of a black circle with a gold circle on top of it, a gold star on top of the gold circle, and several small gold stars scattered around the card. The text "EID" and "MUBARAK" should also be displayed in gold color on the card.
Close the window when you are finished viewing the card.
Comments
Post a Comment