Reputation: 344
I wrote a GUI that is working fine, it's supposed to get some information from a file and to show me on entries, and base on how many lines of info are present, it will generate same many entries.
The problem on this code is: I want to let me to change some values and to save them back on file and I do not know how to take that entry.get() from all entries on the frame. If I try to get a reference on it I will get back just the last entry changes printed.
def DataShow(self):
# Import dictionary after the settings file was read
from res.lib.Settings import app_settings
# Make local frame
frame = ScrolledFrameVertical(self, width=353)
frame.pack(expand=True, fill="y", side="top")
Button(frame, text="Save", command=lambda:save()).pack(fill="x", side="top")
# Create entrys base on dictionary data and info
for data, info in app_settings.items():
d = Settings.Entry(frame, data, 20, info, 31)
def save():
print(d.get())
Upvotes: 2
Views: 548
Reputation: 386230
You can get all children of a widget with .winfo_children()
.
def save():
for child in frame.winfo_children():
print(child.get())
Upvotes: 2