-1
  1. Intro: I want to use a button to get file path, then display the path on the entry
  2. Question: I don't know how to display path on the entry, I search and try a lot yesterday, but all the things I try didn't work. I don't know which part is wrong, hope u can help me, thanks a lot.
  3. My code here:

    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)
    
lol kkk
  • 7
  • 2

1 Answers1

0

I find the solution just now, i changing 1 into 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)
lol kkk
  • 7
  • 2