- Intro: I want to use a button to get file path, then display the path on the entry
- 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.
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)
Asked
Active
Viewed 224 times
-1

lol kkk
- 7
- 2
-
1please do not post pictures of code. Take the time to copy, paste, and format the code. – Bryan Oakley Mar 09 '18 at 03:04
-
thank u ~ I get it ~ I will watch out for these details next time – lol kkk Mar 09 '18 at 03:19
-
Or, you could always [edit] this time. – Nae Mar 09 '18 at 05:26
-
I edited my code already . – lol kkk Mar 09 '18 at 11:12
1 Answers
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