|
- import tkinter as tk
- win = tk.Tk()
- win.geometry('300x200')
- tk.Label(win, text='保存目录', height=1, width=10).grid(row=1, column=0)
- txt_path = tk.Text(win, height=1, width=30, padx=10, pady=5)
- txt_path.grid(row=1, column=1)
- def down_video(sv):
- print(sv)
- def get_addr():
- t = txt_path.get(0.0, tk.END)
- return t
- # print(t)
- # tk.Button(win, text='down', width=10, height=1, command=lambda: down_video(sv=get_addr)).grid(row=2, column=0)
- tk.Button(win, text='down', width=10, height=1, command=lambda: down_video(sv=get_addr())).grid(row=2, column=0)
- tk.Button(win, text='test', command=get_addr).grid(row=4, column=0)
- win.mainloop()
复制代码
这样可以吗? |
|