表白小程序

from tkinter import messagebox
from turtle import *
from PIL import ImageTk as ImageTk1
from PIL import Image as Image1
import time
from tkinter import *


# 1.编写基本GUI界面
class Love(object):
    def __init__(self):
        self.root = Tk()
        self.root.geometry("540x413")
        self.root.title("love")
        self.path = "R-C.jpg"
        self.root.attributes('-toolwindow', 1)
        self.root.attributes('-topmost', 1)
        self.root.resizable(0, 0)

    # 1.表白界面
    def Frame1(self):
        image_path = Image1.open(self.path)
        image = ImageTk1.PhotoImage(image_path)
        lab = Label(self.root, image=image)
        lab1 = Label(self.root, text="1.下面程序更精彩,请按照程序提示操作;", bg="#060606", fg="#d61f0f", font=("Arial", 10, "normal"))
        lab2 = Label(self.root, text="2.欣赏下一个精彩内容之前请先心里准备;", bg="#060606", fg="#d61f0f", font=("Arial", 10, "normal"))
        lab3 = Label(self.root, text="3.下一个程序可能会问你一些问题;", bg="#060606", fg="#d61f0f", font=("Arial", 10, "normal"))
        lab4 = Label(self.root, text="4.如果不好好回答可能会让你不高兴;", bg="#060606", fg="#d61f0f", font=("Arial", 10, "normal"))
        lab5 = Label(self.root, text="5.请点击下面的启动按钮;", bg="#060606", fg="#d61f0f", font=("Arial", 10, "normal"))
        btn = Button(self.root, text="启动", bg="#990f0c", command=self.Main)
        lab.pack()
        lab1.place(x=10, y=10)
        lab2.place(x=10, y=30)
        lab3.place(x=10, y=50)
        lab4.place(x=10, y=70)
        lab5.place(x=10, y=90)
        btn.place(x=10, y=200)
        self.root.mainloop()

    # 2.制作玫瑰花
    def rose(self):
        title("玫瑰花")
        setup(1000, 800, 0, 0)
        speed(0)
        penup()
        seth(90)
        fd(340)
        seth(0)
        pendown()
        write("再给你送一束玫瑰花。请慢慢欣赏!", align="left", font=("Arial", 13, "italic"), move=True)
        goto(-200, 200)

        speed(5)
        begin_fill()
        fillcolor('red')
        circle(50, 30)

        for i in range(10):
            fd(1)
            left(10)

        circle(40, 40)

        for i in range(6):
            fd(1)
            left(3)

        circle(80, 40)

        for i in range(20):
            fd(0.5)
            left(5)

        circle(80, 45)

        for i in range(10):
            fd(2)
            left(1)

        circle(80, 25)

        for i in range(20):
            fd(1)
            left(4)

        circle(50, 50)

        time.sleep(0.1)

        circle(120, 55)

        speed(0)

        seth(-90)
        fd(70)

        right(150)
        fd(20)

        left(140)
        circle(140, 90)

        left(30)
        circle(160, 100)

        left(130)
        fd(25)

        penup()
        right(150)
        circle(40, 80)
        pendown()

        left(115)
        fd(60)

        penup()
        left(180)
        fd(60)
        pendown()

        end_fill()

        right(120)
        circle(-50, 50)
        circle(-20, 90)

        speed(1)
        fd(75)

        speed(0)
        circle(90, 110)

        penup()
        left(162)
        fd(185)
        left(170)
        pendown()
        circle(200, 10)
        circle(100, 40)
        circle(-52, 115)
        left(20)
        circle(100, 20)
        circle(300, 20)
        speed(1)
        fd(250)

        penup()
        speed(0)
        left(180)
        fd(250)
        circle(-300, 7)
        right(80)
        circle(200, 5)
        pendown()

        left(60)
        begin_fill()
        fillcolor('green')
        circle(-80, 100)
        right(90)
        fd(10)
        left(20)
        circle(-63, 127)
        end_fill()

        penup()
        left(50)
        fd(20)
        left(180)

        pendown()
        circle(200, 25)

        penup()
        right(150)

        fd(180)

        right(40)
        pendown()
        begin_fill()
        fillcolor('green')
        circle(-100, 80)
        right(150)
        fd(10)
        left(60)
        circle(-80, 98)
        end_fill()

        penup()
        left(60)
        fd(13)
        left(180)

        pendown()
        speed(1)
        circle(-200, 23)
        # 在点击图形窗口后退出程序
        exitonclick()

    # 3.主程序
    def Main(self):
        messagebox.showinfo("LOVE", "我好像看上你了")
        messagebox.showinfo("LOVE", "感觉我们俩挺适合")
        # 循环
        while True:
            an1 = messagebox.askyesnocancel("LOVE", "你觉得我们俩适合吗?")
            if an1 == True:
                an2 = messagebox.askyesnocancel("LOVE", "那答应做我的女朋友好吗?")
                if an2 == True:
                    break
                else:
                    messagebox.showerror("LOVE", "请不要拒绝我好吗")
            else:
                messagebox.showerror("LOVE", "请不要这么想,其实我们俩挺适合的")
        messagebox.showinfo("LOVE", "太好了,你的回答我已经收到了小仙女")
        messagebox.showinfo("LOVE", "小仙女你在程序里操作的每一个返回结果我都会看到的")
        messagebox.showinfo("LOVE", "哈哈哈,是不是太神奇了!")

        time.sleep(2)
        while True:
            an3 = messagebox.askyesnocancel("wonderful", "还有一个精彩内容等待你欣赏?")
            if an3 == True:
                break
            else:
                messagebox.showerror("wonderful", "请你没有权利拒绝作者的要求")
        messagebox.showinfo("wonderful", "此内容会让你大吃一惊的,请先心里准备")
        messagebox.showinfo("wonderful", "给你送一束玫瑰花")
        self.root.destroy()  # 关闭窗口
        self.rose()


love = Love()
love.Frame1()

 self.path = "R-C.jpg"输入你喜欢的图片路径

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

力江

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值