Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
46 views

Code1 1

The document uses the turtle module in Python to display different background images and text inputs based on user selections. It prompts the user to select an image, enters two texts, positions the texts on the screen, and selects a font. Finally, it displays the texts on the screen in black and white using the selected font and adds a signature in the bottom right corner before exiting.

Uploaded by

api-401251595
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Code1 1

The document uses the turtle module in Python to display different background images and text inputs based on user selections. It prompts the user to select an image, enters two texts, positions the texts on the screen, and selects a font. Finally, it displays the texts on the screen in black and white using the selected font and adds a signature in the bottom right corner before exiting.

Uploaded by

api-401251595
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import turtle

num = turtle.numinput(title="Title ", prompt="choose:\n1: hunhun\n2: do\n3:


kwanlinn\n4: oooo\n5: sadd " )

if num == 1 :
turtle.bgpic(picname="hunhun.gif")
turtle.setup(width=800, height=667)

text1 = turtle.textinput(title="Title", prompt="Enter first text ")


turtle.penup()
topY = 200
topy = topY+5
cornerx = 300

text2 = turtle.textinput(title="Title", prompt="Enter second text ")


bottomY = -200
bottomy = bottomY+5

elif num == 2 :
turtle.bgpic(picname="do.gif")
turtle.setup(width=800, height=549)

text1 = turtle.textinput(title="Title", prompt="Enter first text ")


turtle.penup()
topY = 200
topy = topY + 6
cornerx = 250

text2 = turtle.textinput(title="Title", prompt="Enter second text ")


bottomY = -200
bottomy = bottomY + 6

elif num == 3 :
turtle.bgpic(picname="kwanlinn.gif")
turtle.setup(width=500, height=334)

text1 = turtle.textinput(title="Title", prompt="Enter first text ")


turtle.penup()
topY = 90
topy = topY + 3
cornerx = 270

text2 = turtle.textinput(title="Title", prompt="Enter second text ")


bottomY = -150
bottomy = bottomY + 2

elif num == 4:
turtle.bgpic(picname="oooo.gif")
turtle.setup(width=800, height=450)

text1 = turtle.textinput(title="Title", prompt="Enter first text ")


turtle.penup()
topY = 150
topy = topY + 5
cornerx = 300

text2 = turtle.textinput(title="Title", prompt="Enter second text ")


bottomY = -200
bottomy = bottomY + 5

elif num == 5:
turtle.bgpic(picname="sadd.gif")
turtle.setup(width=350, height=350)

text1 = turtle.textinput(title="Title", prompt="Enter first text ")


turtle.penup()
topY = 100
topy = topY + 3
cornerx = 100

text2 = turtle.textinput(title="Title", prompt="Enter second text ")


bottomY = -150
bottomy = bottomY + 3

chooseFont = turtle.numinput(title = "Font", prompt = "Choose:\n1: Impact\n2:


Arial\n3: Tahnoma\n4: Verdana\n5: Comic Sana MS")

if chooseFont == 1 :
usefont = "Impact"
elif chooseFont ==2:
usefont = "Arial"
elif chooseFont ==3:
usefont = "Tahnoma"
elif chooseFont ==4:
usefont = "Verdana"
elif chooseFont ==5:
usefont = "Comic Sana MS"

turtle.color("black")
turtle.goto(0,topY)
turtle.write(arg = text1, move=True , align="center" , font=(usefont, 35, "normal"
) )
turtle.goto(0,bottomY)
turtle.write(arg = text2, move=False , align="center" , font=(usefont, 35, "normal"
) )

turtle.color("white")
turtle.goto(0,topy)
turtle.write(arg = text1, move=True , align="center" , font=(usefont, 35, "normal"
) )
turtle.goto(0,bottomy)
turtle.write(arg = text2, move=False , align="center" , font=(usefont, 35, "normal"
) )

turtle.penup()
cornery = bottomY-30
turtle.goto(cornerx, cornery)
turtle.color("black")
turtle.pendown()
turtle.write(arg = "littleRidaw ", move =False, align = "right", font = (usefont,
20, "normal"))
cornery = cornery+2
cornerx= cornerx-4
turtle.goto(cornerx, cornery)
turtle.color("white")
turtle.pendown()
turtle.write(arg = "littleRidaw ", move =False, align = "right", font = (usefont,
20, "normal"))

turtle.exitonclick()

You might also like