Compare commits
4 Commits
0897d7047e
...
55a7d3f211
Author | SHA1 | Date |
---|---|---|
dqs2956213868 | 55a7d3f211 | 6 months ago |
dqs2956213868 | 7a24873a76 | 6 months ago |
dqs2956213868 | 4c9151c4fd | 6 months ago |
dqs2956213868 | d3f7228e6d | 6 months ago |
@ -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()
|
Binary file not shown.
Loading…
Reference in new issue