This is a practice project to help me learn python so it's all experimental. I've tried a variety of things and now I'm beginning to get lost in the haze (as you can probably see below). How can I populate a TKinter combobox from a simple txt file in Python 3? Any help would be great.
- This program randomly generates 10 passwords which the user can select from and it will eventually be saved to a file with a date.
- My text file is called PWFile.txt
- PWFile.txt contains a set of 10 passwords in a column/list
The following does everything except populate the combobox:
In_file = open("PWfile.txt","r")
line = f.readlines()
print(line, end=' ')
combovalues = []
in_line = in_file.readlines()
root = Tk()
root.title("Password GUI")
root.geometry('350x200')
Label(root, text="Password Options - Choose a password").grid(row=0)
combo = Combobox(root, width=28, height=10, font=("Helvetica", 9), state="enabled")
combovalues.append(line)
combo['text'] = combovalues
combo.grid(column=0, row=1)
Quitbtn = Button(root, text="Quit", command=quit)
Quitbtn.grid(column=2, row=1)
root.mainloop()