The title probably makes my goal sound a little confusing since I wasn't sure of the best way to word it but I'd like to add the ability to edit a list of strings, allow a user to edit them, and then save them to the program that I'm currently working on. An easy way would be to create a label
with an entry
that corresponds to it and set the value of a variable to entry.get()
. Such as:
row=0
for line in build: # build is a list of strings
Label(build_window,text=line).grid(row=row,column=0,sticky=W)
# build_window is a Toplevel of 'main_screen'
Entry(build_window).grid(row=row,column=1,sticky=W)
# I know I'd need to save the entry as a variable or some other way in order to access
# the value but I left it like this for demonstration
row+=1
This would create a label and an entry on the same row, then the value of entry.get()
would be saved. But the problem is that build
contains 50+ lines of strings and this setup would need a very large amount of space in order to use. Would you be able to use Listbox()
and Scrollbar()
in order to achieve this effect? (Asking as that's how I've listed them previously in my program) I've tried indexing a Listbox()
object like you would a normal list (ListboxObject[1]
) but it just returns an error saying that it takes a string, not an int.