Compare commits

...

4 Commits

@ -0,0 +1,37 @@
import tkinter as tk
import tkinter.messagebox
window = tk.Tk()
window.title("my window")
window.geometry("450x300")
# welcome image
canvas = tk.Canvas(window, height=200, width=500)
image_file = tk.PhotoImage(file="")
image = canvas.create_image(0, 0, anchor='nw', image=image_file)
canvas.pack(side='top')
# 电影名
tk.Label(window, text="电影名").place(x=100,y=150)
# 输入框
var_search = tk.StringVar()
var_search.set("哈尔的移动城堡")
entry_search = tk.Entry(window, textvariable=var_search)
entry_search.place(x=150,y=150)
def search_movie():
movie = entry_search.get()
if movie == "":
tk.messagebox.showwarning(title="错误", message="请输入电影名")
else:
tk.messagebox.showinfo(title="搜索", message="你搜索了" + movie)
# 搜索框
bth_search = tk.Button(window, text="搜索", command=search_movie)
bth_search.place(x=310,y=145)
window.mainloop()
Loading…
Cancel
Save