打包好的exe文件可以私聊获取。。。。这是个使用tkinter创建pythonGUI程序的例子。。
from tkinter import *
from tkinter import messagebox
#创建一个窗口
window = Tk()
#set size
window.geometry('320x450+464+204')
#窗口标题
window.title('你喜欢我吗?')
def closeWindow():
messagebox.showinfo(title='警告',message='不许关闭,好好回答')
#点击关闭
window.protocol('WM_DELETE_WINDOW',closeWindow)
#lable
label1=Label(window,text='hey 小王老弟',font=('微软雅黑',14))
label1.grid()
label2=Label(window,text='喜欢我吗?',font=('微软雅黑',18))
label2.grid(row=1,column=1,sticky=W)
#SET picture
photo = PhotoImage(file=r'D:/src/520/cc.gif')
imgLabel=Label(window,image=photo)
imgLabel.grid(row=2,columnspan=2)
def closeall():
window.destroy()
def love():
love = Toplevel(window) #独立的顶级窗口
love.geometry('250x100+504+254')
lable = Label(love,text='好巧,我也是',font=('微软雅黑',24))
lable.pack()
btn3=Button(love,text='确定',width=10,height=2,command=closeall)
btn3.pack()
def closeno():
nolove()
def nolove():
nolove = Toplevel(window) #独立的顶级窗口
nolove.geometry('250x100+504+254')
nolove.title('再考虑考虑呗')
nolable = Label(nolove,text='再考虑考虑呗',font=('微软雅黑',24))
nolable.pack()
btn4=Button(nolove,text='好的',width=10,height=2,command=nolove.destroy)
btn4.pack()
nolove.protocol('WM_DELETE_WINDOW', closeno)
#button
btn1 = Button(window,text='喜欢',width=15,height=3,command=love)
btn1.grid(row=3,column=0,sticky=W)
btn2 = Button(window,text='不喜欢',command=nolove)
btn2.grid(row=3,column=1,sticky=E)
#显示窗口
window.mainloop()