制作抖音表白神器

###跟着老杨玩python
要表白,python帮你搞定

from tkinter import *                   
from PIL import Image ,ImageTk          
import tkinter                          
import tkinter.messagebox               

root=Tk()
root.title('小姐姐,我要向你表白!')
root.geometry("600x500+300+100")
cv= Canvas(root, width = 600, height =500, bg = "white")
cv.pack()
image = Image.open('2.jpg')
im = ImageTk.PhotoImage(image)
cv.create_image(270,190,image = im)
def oppose():
    tkinter.messagebox.showinfo(title='扎心了!', message='再考虑考虑吧,不要急着回答')
def agree():
    tkinter.messagebox.showinfo( title="欧耶", message="我不同意咯!")
    tkinter.messagebox.showinfo( title="欧耶", message="别再打扰我了!")
    root.destroy()
def hesitate ():
    tkinter.messagebox.showinfo(title='别纠结了', message='你完了,你妈让你嫁给我')
    tkinter.messagebox.showinfo(title='别纠结了', message='你爸也是这么说的')
    tkinter.messagebox.showinfo(title='别纠结了', message='你奶奶也让你嫁给我')
    tkinter.messagebox.showinfo(title='别纠结了', message='你哥哥也同意了')
    tkinter.messagebox.showinfo(title='别纠结了', message='你闺蜜说嫁给我没错')
    tkinter.messagebox.showinfo(title='别纠结了', message='你爸说不同意就打你')
    tkinter.messagebox.showinfo(title='别纠结了', message='掉水我先救你')
    tkinter.messagebox.showinfo(title='别纠结了', message='孩子难产我保大')
    tkinter.messagebox.showinfo(title='别纠结了', message='银行卡都给你')
    tkinter.messagebox.showinfo(title='别纠结了', message='接受现实吧,我会对你好的')
def closeWindow():
    tkinter.messagebox.showerror(title='未作回应',message='小姐姐,请不要逃避!')
    return  False
root.protocol('WM_DELETE_WINDOW', closeWindow)
output_label0 = Label(root,text ="实话告诉你吧", font =("仿宋", 16,"bold"))
cv.create_window(20, 20, anchor=NW, window= output_label0)                       
output_label1 = Label(root,text ="我喜欢你很久了", font =("仿宋", 16,"bold"))
cv.create_window(40, 70, anchor=NW, window= output_label1)
output_label2 = Label(root,text ="你看着办吧", font =("仿宋", 16,"bold"))
cv.create_window(50, 110, anchor=NW, window= output_label2)
Button1 = Button(root, text="同意", font =("仿宋", 16,"bold"),width=10,height=1,command = agree)
cv.create_window(110, 430, anchor=NW, window=Button1)        
Button2 = Button(root,text='考虑一下', font =("仿宋", 16,"bold"),width=10,height=1,command = hesitate )
cv.create_window(260, 430, anchor=NW, window=Button2)       
Button3 = Button(root,text='不同意', font =("仿宋", 16,"bold"),width=10,height=1,command = oppose)
cv.create_window(450, 430, anchor=NW, window=Button3)       
root.mainloop()

制作抖音表白神器_第1张图片

你可能感兴趣的:(python)