用户输入条目在窗口中(opnw1),显示整个故事的代码应该是什么,包括窗口中的条目(opnw1a),请给我一个示例代码。
import tkinter as tk
from tkinter import *
import PIL
from PIL import ImageTk
root = tk.Tk()
root.title("MAD LIBS STORY GENERATOR")
root.geometry("650x200")
root.configure(bg = "cyan")
w = tk.Label(root, text="WELCOME TO MAD LIBS STORY GENERATOR!" ,fg = "black", bg = "cyan", font = "Helvetica 20 bold italic")
w.pack()
photo1 = PhotoImage(file = r"E:\pen.png")
photoimage1 = photo1.subsample(3,3)
def opnw():
top = Toplevel(root)
top.title("CHOICES!!")
top.geometry("650x200")
top.configure(bg="cyan")
s = tk.Label(top,text=" CHOOSE YOUR STORY CHOICE : ", fg="Black" , bg = "cyan" , font="Helvetica 20 bold italic")
s.pack()
def opnw1():
top1 = Toplevel(top)
top1.title("bE KIND")
top1.geometry("400x500")
top1.configure(bg="cyan")
t = tk.Label(top1,text="FILL YOUR WORDS" , fg="dark blue" , bg="cyan" , font="helvetica 30 italic")
t.pack()
l1 = tk.Label(top1, text=" NOUN : " , fg="black" , bg="cyan" , font="helvetica 15 bold")
l1.pack()
e1 = tk.Entry(top1, bd=6)
e1.pack()
l2 = tk.Label(top1, text=" NOUN(PLURAL) : " , fg="black" , bg="cyan" , font="helvetica 15 bold")
l2.pack()
e2 = tk.Entry(top1, bd=6)
e2.pack()
l3 = tk.Label(top1, text=" NOUN : " , fg="black" , bg="cyan" , font="helvetica 15 bold")
l3.pack()
e3 = tk.Entry(top1, bd=6)
e3.pack()
l4 = tk.Label(top1, text=" PLACE : " , fg="black" , bg="cyan" , font="helvetica 15 bold")
l4.pack()
e4 = tk.Entry(top1, bd=6)
e4.pack()
l5 = tk.Label(top1, text=" ADJECTIVE : " , fg="black" , bg="cyan" , font="helvetica 15 bold")
l5.pack()
e5 = tk.Entry(top1, bd=6)
e5.pack()
l6 = tk.Label(top1, text=" NOUN : " , fg="black" , bg="cyan" , font="helvetica 15 bold")
l6.pack()
e6 = tk.Entry(top1, bd=6)
e6.pack()
def opwn1a():
top3 = Toplevel(top1)
top3.title("Completed story")
top3.geometry("700x700")
top3.configure(bg="cyan")
def st(top3):
l1=e1.get()
l2=e2.get()
l3=e3.get()
l4=e4.get()
l5=e5.get()
l6=e6.get()
story = "be kind to your"
story += l1
story +="-footed"
story += l2
story +="For a duck may ne somebody's"
story += l3
story += "Be kind to your"
story += l2
story += "in"
story += l4
story += "where the weather is always"
story += l5
story += "you may think that this is the"
story += l6
story += "Well It is."
d = tk.Button(top1, text="LET'S GO!!" , bd=7,fg="white" , bg="navy blue", command=lambda:[opwn1a,top3.st])
d.pack()
a = tk.Button(top, text="BE KIND" , bd=6 , font="helvetica" , compound = LEFT , command = opnw1)
a.pack()
def opnw2():
top2 = Toplevel(top)
top2.title("soooo")
top2.geometry("700x300")
top2.configure(bg="cyan")
u = tk.Label(top2, text="fILL YOUR WORDS" , fg="dark blue" , bg="cyan" , font="helvetica 30 italic")
u.pack()
b = tk.Button(top, text="Sooooooo" , bd=6 , font="helvetica" , compound = RIGHT , command = opnw2)
b.pack()
v = tk.Button(root, text = "Let's Create A Story!!", bd = 6 ,font = "helvetica", image = photoimage1 , compound = RIGHT , command=opnw)
v.pack()
frame = Frame(root)
frame.pack()
canvas = Canvas(frame, bg="cyan", width=105 , height=100 , highlightthickness=0)
canvas.pack()
photoimage = ImageTk.PhotoImage(file="E:\lmf.png")
canvas.create_image(55, 47 , image=photoimage)
root.mainloop()