I'm trying to read file and display it and get user input like in how many minutes he want that file to be displayed.
Currently I'm using .get()
to input file path and minutes after which he want that file to be displayed but to make it more user readable I want to implement drop down menu showing minutes and file box (D:/ drive view of particular folder where file resides).
How can I code it using python Tkinter ?
I researched but no luck as of now.
----EDIT----
Snippet of how I'm doing it manually
def add_item():
print(link_text.get(),small_break.get(),large_break.get(),maxrun_hours.get(),maxrun_minutes.get()
,exerun_hours.get(),exerun_minutes.get())
if link_text.get() == '' or small_break.get() == '' or large_break.get() == '' or maxrun_hours.get() == '' or maxrun_minutes.get() == '' or exerun_hours.get() == '' or exerun_minutes.get() == '':
messagebox.showerror('Required Fields', 'Please include all fields')
return
How I take input:
link_text = StringVar()
link_label = Label(app, text='TT-LINK', font=('bold', 14), pady=20, foreground="white",bg="black")
link_label.grid(row=0, column=0, sticky=W)
link_entry = Entry(app, textvariable=link_text, relief="solid")
link_entry.grid(row=0, column=1)
Any suggestions would be much appreciated !
CodePudding user response:
TRY:
example = StringVar()
example_label = Label(app, text='example')
example_label.grid(add positional cords)
list = ttk.Combobox(app, textvariable=example)
# Adding combobox drop down list
list['values'] = ('Enter entries manually to populate')
list.grid(add positional cords)
list.current()
Hope that helps...!