How to store simple text data in the python program itself? -


i'm making program ease work. concept of has company names (i'll make button add more of them) , stores info when , loan took.

so open program, displays company names, click on them , opens window of taken loans (also going make button add more loans @ different dates). want make program store company names , loans took can add more , more of them.

i'm going add info through simple entry dialogs.

how possible store info in program when press button? small window pop info?

for basics, should check out json library python: https://docs.python.org/2/library/json.html

here's quick example:

>>> import json # grabs config.json in same directory python file >>> open("config.json", "r") e: ...     myconfig = json.load(e) >>> print myconfig {u'4': u'5', u'6': 7} # dump string representation >>> config_string = json.dumps(myconfig) >>> config_string '{"4": "5", "6": 7}' # load text >>> json.loads(config_string) {u'4': u'5', u'6': 7} # dump config file >>> open("config.json", "w") e: ...    json.dump(myconfig, e) 

this looks in current directory, , shows 2 ways of loading , dumping json configuration. should using first , last one. once loaded, json object translated python dictionary, , acts identically. likewise, python dictionary comprised of dictionaries, lists, , strings act identically json. difference integer or numerical key converted float.

as gui frameworks, recommend pyside (qt) or tkinter. qt extensive, has excellent, excellent documentation , extremely rich in features, making quite easy extend application need be. however, as c++ framework, best documentation written c++ version, however, there excellent resources pyside.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -