|
楼主 |
发表于 2020-5-25 12:40:37
|
显示全部楼层
from tkinter import *
from tkinter import Button
from tkinter import messagebox
import turtle
from pygame import mixer
import time
from PIL import ImageTk
import threading
# from multiprocessing import pool
class Application(Frame):
def __init__(self,master=None):
super().__init__(master)
self.master=master
self.pack()
self.createWidget()
def createWidget(self):
self.label01=Label(self,text="请告诉我今天是什么日子?",font=20, width=30,height=2)
self.label01.pack()
v1=StringVar()
self.entry01=Entry(self,textvariable=v1,bd=5)
self.entry01.pack()
self.label02 = Label(self, text="密码是4位数字",font=20,width=20,height=2)
self.label02.pack()
v2 = StringVar()
self.entry02 = Entry(self, textvariable=v2,show="*",bd=5)
self.entry02.pack()
self.button01=Button(self,text='点我一下吧!',font=20,fg='red',padx=20,pady=5,
width=10,height=2,command=self.login)
self.button01.pack()
def login(self):
username=self.entry01.get()
pwd=self.entry02.get()
if username=='结婚纪念日' and pwd=="0619":
huatu()
else:
messagebox.showinfo('陈雪专用',"牛头不对马嘴,请重新输入")
# def haigui():
# bgt = bjsz()
# huatu1=huatu()
# threads1 = []
# threads1.append(threading.Thread(target=bgt))
# threads1.append(threading.Thread(target=huatu1))
# if __name__ == '__main__':
# for t in threads:
# t.start()
def huatu():
str = ('老婆,结婚5周年快乐!!!')
# turtle.textinput('小小的惊喜')
turtle.speed(50)
turtle.setup(1800, 700, 70, 70)
turtle.color('blue', 'pink')
turtle.pensize(5)
turtle.hideturtle()
turtle.up()
turtle.goto(-655, -255)
turtle.down()
turtle.showturtle()
turtle.goto(-600, -200)
turtle.goto(-600, -120)
turtle.circle(35)
turtle.goto(-600, -200)
turtle.forward(40)
turtle.right(90)
turtle.forward(60)
turtle.hideturtle()
turtle.up()
turtle.goto(-600, -160)
turtle.down()
turtle.showturtle()
turtle.left(90)
turtle.forward(55)
turtle.right(45)
turtle.forward(20)
turtle.hideturtle()
turtle.up()
turtle.goto(-600, -145)
turtle.down()
turtle.showturtle()
turtle.goto(-545, -145)
turtle.left(90)
turtle.forward(20)
turtle.color('pink', 'pink')
turtle.begin_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(-500, -153)
turtle.down()
turtle.showturtle()
turtle.right(90)
turtle.forward(30)
turtle.left(90)
turtle.forward(30)
turtle.left(45)
turtle.circle(10.6, 180)
turtle.left(180)
turtle.circle(10.6, 180)
turtle.end_fill()
turtle.color('pink', 'pink')
turtle.begin_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(-430, -143)
turtle.down()
turtle.showturtle()
turtle.left(135)
turtle.right(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(45)
turtle.circle(17.67, 180)
turtle.left(180)
turtle.circle(17.67, 180)
turtle.end_fill()
turtle.color('pink', 'pink')
turtle.begin_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(-315, -133)
turtle.down()
turtle.showturtle()
turtle.left(135)
turtle.right(90)
turtle.forward(70)
turtle.left(90)
turtle.forward(70)
turtle.left(45)
turtle.circle(24.74, 180)
turtle.left(180)
turtle.circle(24.74, 180)
turtle.end_fill()
turtle.color('pink', 'pink')
turtle.begin_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(-187, -133)
turtle.down()
turtle.showturtle()
turtle.left(135)
turtle.right(90)
turtle.forward(70)
turtle.left(90)
turtle.forward(70)
turtle.left(45)
turtle.circle(24.74, 180)
turtle.left(180)
turtle.circle(24.74, 180)
turtle.end_fill()
turtle.color('pink', 'pink')
turtle.begin_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(-43.7, -143)
turtle.down()
turtle.showturtle()
turtle.left(135)
turtle.right(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(45)
turtle.circle(17.67, 180)
turtle.left(180)
turtle.circle(17.67, 180)
turtle.end_fill()
turtle.color('pink', 'pink')
turtle.begin_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(53.88, -153)
turtle.down()
turtle.showturtle()
turtle.right(90)
turtle.right(225)
turtle.forward(30)
turtle.left(90)
turtle.forward(30)
turtle.left(45)
turtle.circle(10.6, 180)
turtle.left(180)
turtle.circle(10.6, 180)
turtle.end_fill()
turtle.hideturtle()
turtle.up()
turtle.goto(251.28, -255)
turtle.down()
turtle.showturtle()
turtle.goto(196.28, -200)
turtle.goto(196.28, -120)
turtle.left(90)
turtle.circle(35)
turtle.goto(196.28, -200)
turtle.left(180)
turtle.forward(40)
turtle.left(90)
turtle.forward(60)
turtle.hideturtle()
turtle.up()
turtle.goto(196.28, -160)
turtle.down()
turtle.showturtle()
turtle.right(90)
turtle.forward(55)
turtle.left(45)
turtle.forward(20)
turtle.hideturtle()
turtle.up()
turtle.goto(196.28, -145)
turtle.down()
turtle.showturtle()
turtle.right(45)
turtle.forward(55)
turtle.right(45)
turtle.forward(20)
turtle.hideturtle()
turtle.up()
turtle.goto(-265, -133)
turtle.down()
turtle.showturtle()
turtle.goto(-245, 0)
turtle.right(135)
turtle.circle(35)
turtle.hideturtle()
turtle.up()
turtle.goto(-265, -133)
turtle.down()
turtle.showturtle()
turtle.goto(-305, 80)
turtle.circle(40)
turtle.hideturtle()
turtle.up()
turtle.goto(-137, -133)
turtle.down()
turtle.showturtle()
turtle.goto(-167, 0)
turtle.circle(35)
turtle.hideturtle()
turtle.up()
turtle.goto(-137, -133)
turtle.down()
turtle.showturtle()
turtle.goto(-117, 80)
turtle.circle(40)
turtle.pencolor("ORANGE")
turtle.penup()
turtle.goto(-245, 10)
turtle.write("O", move=False, align='center', font=("微软雅黑", 30, 'normal'))
turtle.pencolor("RED")
turtle.penup()
turtle.goto(-305, 90)
turtle.write("L", move=False, align='center', font=("微软雅黑", 30, 'normal'))
turtle.pencolor("YELLOW")
turtle.penup()
turtle.goto(-167, 10)
turtle.write("V", move=False, align='center', font=("微软雅黑", 30, 'normal'))
turtle.pencolor("GREEN")
# turtle.penup()
turtle.goto(-117, 90)
turtle.write("E", move=False, align='center', font=("微软雅黑", 30, 'normal'))
turtle.pencolor("PINK")
turtle.penup()
turtle.goto(300, 100)
turtle.write(str, move=False, align='center', font=("方正舒体", 30, 'normal'))
def move_pen_position(x, y):
turtle.hideturtle() # 隐藏画笔(先)
turtle.up() # 提笔
turtle.goto(x, y) # 移动画笔到指定起始坐标(窗口中心为0,0)
turtle.down() # 下笔
turtle.showturtle() # 显示画笔love = input("请输入表白话语:")
signature = "刘东&陈雪"
date = "2020.06.19"
turtle.color('red', 'pink')
time.sleep(0.5)
move_pen_position(350, -180)
turtle.hideturtle() # 隐藏画笔
turtle.write(signature, align="center",font=("方正舒体", 30, 'normal'))
move_pen_position(350, -230)
turtle.hideturtle() # 隐藏画笔
turtle.write(date, align="center",font=("方正舒体", 30, 'normal'))
window = turtle.Screen()
window.exitonclick()
# def bjsz():
# turtle.bgpic(r'jiehun.gif') # 这样设置。e68a84e799bee5baa6e997aee7ad9431333431346334
def bofang():
mixer.init()
mixer.music.load('爱很简单.mp3')
mixer.music.play()
time.sleep(1000)
mixer.music.stop()
def huitu():
root = Tk()
root.geometry("500x300+200+200")
root.title('结婚纪念日专用程序')
app = Application(master=root)
root.mainloop()
threads = []
threads.append(threading.Thread(target=bofang))
threads.append(threading.Thread(target=huitu))
if __name__ == '__main__':
for t in threads:
t.start()
# if __name__=='__main__':
# s1=bofang()
# s2=huitu()
# thre = threading.Thread(target=func, args=(3,))
|
|