我的代码在这里:
class PageOne(tk.Frame):
def __init__(self, parent, controller):
ttk.LabelFrame.__init__(self, parent,text='video detection')
self.grid(column=0, row=0, padx=10, pady=10)
ttk.Label(self, text="video addr:").grid(column=0, row=0, padx=3, pady=5)
self.entry_1 = ttk.Entry(self).grid(column=1, row=0, padx=3, pady=3)
ttk.Button(self, text='select', width=8, command = lambda: self.vid_sel_btn()).grid(column=2, row=0, padx=5, pady=5)
def vid_sel_btn(self):
path = filedialog.askopenfilename()
self.entry_1.insert(0,select_path)
答案 0 :(得分:0)
我刚才找到解决方案,我将1改为2
1.self self.entry_1 = ttk.Entry(self).grid(column=1,row=0,padx=3, pady=5)
2.self.entry_1 = ttk.Entry(self)
self.entry_1.grid(column=1,row=0,padx=3, pady=5)