[Tutor] save configuration of one application.

hok kakada hokkakada at khmeros.info
Wed Oct 11 10:44:02 CEST 2006


On Wednesday 04 October 2006 11:54, John Fouhy wrote:
> On 04/10/06, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> > you can make a config.ini file and use that one module that parses ini
> > files.
> > I can't remember what it's called.
> > configparser I think, but I wouldn't bet my life on it :)
>
> Yes, ConfigParser.
>
> The docs for ConfigParser are a bit confusing in places (IMO), but
> there are people here who can help if you get stuck.
>
> > Or you could just write the settings out to a file.
>
> Using ConfigParser means your configuratino files will be
> human-readable and human-editable.  If you don't care about that, you
> could stick them in a dictionary and use pickle to write it to a file.
>  Or use the shelve module.
>
> > If you choose to go the latter route, keep in mind that  modules are
> > compiled to .pyc files upon importation,
> > so you'll have to remove those anytime you modify config.py or the old
> > code will be used instead.
>
> The python interpreter should check the timestamps on foo.py vs
> foo.pyc, and recompile if it thinks things have changed.
Thank both of you. 

I'd have added some points about it. I used PyQt for designing GUI. Hence, in 
this case, I want to open a Font Dialog box in order to choose fontname, size 
and so on. Then set all these values to the textEdit.

For the secode time we open the font dialog, the previous selected font will 
be set to the font family and font size of the font dialog.

Is there any way to do it?

Thanks again,

da


More information about the Tutor mailing list