[Tutor] Retriving previous user inputs in a gui
Alan Gauld
alan.gauld at btinternet.com
Tue Aug 24 20:03:20 CEST 2010
"Karim" <karim.liateni at free.fr> wrote
> I am figuring this out. I want a sort of file who store values
> entered previously in a gui.
Thats easy enough - have you succeeded with this bit - check the
file with a text editor...
> Th e next time the user launch his gui in the same directory the gui
> load the previous value from this file.
Again thats pretty easy, did you get this working - create the file
with a text editior?
> Is there any modules in Tkinter for that?
No, Tkinter is for building GUIs. Python core language includes
functions for reading and writing to files. Can you do this outside a
GUI?
Write a program to read the users name and save it to a file.
Write a program to read the file and print the name it finds.
Write a program that says Hello <name> if it finds a name and asks for
a name if it doesn't.
Now translate that to your GUI.
> suppose the file could
> be in xml format or whatever?
Yes, it could be in whatever. CSV, XML, ConfigParser or even plain
text.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list