Skip to main content

PYTHON TUTRLE


 LEARN WITH FUN@FUTURE_CODE

  😘ONLINE PROPOSAL 😍

Python  uses an interpreter to translate and run its code and that’s why it’s called a scripting language. 

A  python script normally can be full of functions that can be be imported as a library of function in other scripts.


This python code will help you to propose your girlfriend/boyfriend.

we are going to draw the rose flower🌹 with text to propose someone💖

PREVIEW:

  





Requirements: Text editor such as Python IDLE (pycharm).

  • Install the python text editor such as pycharm  use this source code given below.


  • Import the turtle module. This  turtle module  is a pre-installed python library that enables users to create pictures and shapes by providing them with a virtual canvas. 

                  To install turtle module : pip install turtle  


Let's we import the turtle module as t.

Then we create a function to draw the curve degree for rose. To draw the curved degree we use for loop in range of n.

import turtle as t

def DegreeCurve(n, r, d=1):

    for i in range(n):

        t.left(d)


Let's we make circle to make the bottom of the rose with radius r. 


t.circle(r, abs(d))


Now we create pen and we make the pen colour as black and fill_colour of the rose as red(which colour you need) and we creating the leaves with green colour. 


s=0.2

t.setup(450*5*s, 750*5*s)

t.pencolor("black")

t.fillcolor("red")

t.speed(100)

t.penup()

t.goto(0, 900*s)

t.pendown()

t.begin_fill()

t.circle(200*s,30)

DegreeCurve(60,50*s)

t.circle(200*s,30)

DegreeCurve(4,100*s)

t.circle(200*s,50)

DegreeCurve(50,50*s)

t.circle(350*s,65)

DegreeCurve(40,70*s)

t.circle(150*s,50)

DegreeCurve(20,50*s,-1)

t.circle(400*s,60)

DegreeCurve(18,50*s)

t.fd(250*s)

t.right(150)

t.circle(-500*s,12)

t.left(140)

t.circle(550*s,110)

t.left(27)

t.circle(650*s,100)

t.left(130)

t.circle(-300*s,20)

t.right(123)

t.circle(220*s,57)

t.end_fill()

t.left(120)

t.fd(280*s)

t.left(115)

t.circle(300*s,33)

t.left(180)

t.circle(-300*s,33)

DegreeCurve(70,225*s,-1)

t.circle(350*s,104)

t.left(90)

t.circle(200*s,105)

t.circle(-500*s,63)

t.penup()

t.goto(170*s,-30*s)

t.pendown()

t.left(160)

DegreeCurve(20,2500*s)

DegreeCurve(220,250*s,-1)

t.fillcolor('green')

t.penup()

t.goto(670*s,-180*s)

t.pendown()

t.right(140)

t.begin_fill()

t.circle(300*s,120)

t.left(60)

t.circle(300*s,120)

t.end_fill()

t.penup()

t.goto(180*s,-550*s)

t.pendown()

t.right(85)

t.circle(600*s,40)

t.penup()

t.goto(-150*s,-1000*s)

t.pendown()

t.begin_fill()

t.rt(120)

t.circle(300*s,115)

t.left(75)

t.circle(300*s,100)

t.end_fill()

t.penup()

t.goto(430*s,-1070*s)

t.pendown()

t.right(30)

t.circle(-600*s,35)


Now we create the text what we need to insert in the rose.To create the text we are going to define the function as text.

lets we set position of text in the rose(-58,-21)which represent the x, y coordinates of 2D.

The colour and font of the text are set. And my text be "I LOVE YOU BABY".(instead of using the text baby you can put your boyfriend/girlfriend name)


def txt():

    t.penup()

    t.setpos(-58,-21)

    t.pendown()

    t.color('blue')

    t.write("I LOVE YOU BABY",font=("verdana",21,"bold"))

txt()


The turtle.done() function is used to starts the event loop calling Tkinter's main loop functions.It must be the last statement of the turtle code.


t.done()


OUTPUT:




click for  source code




Comments

Popular posts from this blog

Python boto3 send_message

  Automated message  PyAutoGUI is a Python automation library used to click, drag, scroll, move, etc. It can be used to click at an exact position. PyAutoGUI module ,Python scripts control the mouse and keyboard to automate interactions with other applications. The API is designed to be as simple. PyAutoGUI works on Windows, macOS, and Linux, and runs on Python 2 and 3.   This code is used to create the automated message in WhatsApp, iMessage, telegram and other social media.  Preview : Requirements:  text editor such as Python IDLE. In my case I’m using Pycharm {In mobile you can use Pydroid 3} Modules: PyautoGUI. Import the relevant module {pyautogui}. This pyautogui is pre-installed  python library that enables the users to create automations and mouse, keyboard controls. Features:  Sending keystrokes to applications (for example, to fill out forms). Take screenshots, and it is saved as .png or .jpeg extension. Locate an applicat...

Arduino projects

  I love you 8x8 matrix display MAX7219 Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. The Wiring and Arduino both use C/C++ as programming languages and Arduino uses a simplified version. Processing used Java as a programming language but served as the basis for Wiring, which was the basis for Arduino. In this tutorial we are creating the led display in 8x8 matrix MAX7219 module. Preview : Components required: Arduino UNO board LED matrix MAX7219 Jumper wires Diagram: In proteus schematic diagram: First we need Arduino IDLE for creating the led matrix display program. Download the Arduino IDLE from the given below link Arduino IDLE download link:  https://www.arduino.cc/en/software Then we need to dow...