tkconfigeditor


Nametkconfigeditor JSON
Version 0.12 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/tkconfigeditor
SummaryDynamic tkinter config editor for files created with ConfigParser
upload_time2023-03-16 20:21:56
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords configparser tkinter edit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Dynamic tkinter config editor for files created with ConfigParser



If you have a friend or a client who doesn’t know anything about python, but wants to change some settings without touching the py file, 

you can use tkconfigeditor. Just add it on top of your python file. 



## pip install tkconfigeditor



### Tested against Python 3.9.15 / Windows 10 / Anaconda 





```python

[mysql]

host = localhost

user = user7

passwd = s$cret

db = ydb



[postgresql]

host = localhost

user = user8

passwd = mypwd$7

db = testdb

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/1.png "Example")



```python

[dev]

api_url = https://gorest.co.in/public/v2/users

save_dir = /Users/dradecic/Desktop/users_data

save_file = users.json



[prod]

api_url = https://gorest.co.in/public/v2/users

save_dir = /tmp/users_data

save_file = users.json

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/2.png "Example")



```python

[openweather]

api_key = mt732wbt5kh5ea4bkw7qytbb9gdkaew4



[twitter]

consumer_key = d53Qe4uf5LMWuQeQFFG66n6BN

consumer_secret = Yxf5n2BwnRELRrkkVjWgpTu48sz5KwGD52324PuwkFWdmVGP4m

access_token = 9922431-d53Qe4uf5LMWuQeQFFG66n6BN

access_token_secret = ubfWMR8WYucrzeaQdrqkm6SrhYTMVQSsxZWpNbtUCMX5u



[google]

api_key = ubfWMR8WYucrzeaQdrqkm6SrhYTMVQSsxZWpNbtUCMX5u

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/3.png "Example")





```python

[book]

title: The Python Standard Library

author: Fredrik Lundh

email: fredrik@pythonware.com

version: 2.0-001115



[ematter]

pages: 250



[hardcopy]

pages: 350

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/4.png "Example")





```python

[DEFAULT]

serverthreads = 45

content_type = text/html

content_length = 1024

autoscaling = no



[website_name.org]

username = your_name

login_mail = your_mail



[private.data.com]

password = secret_password

autoscaling = yes

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/5.png "Example")



```python

[DEFAULT]

serverthreads = 45

content_type = text/html

content_length = 1024

autoscaling = no



[website_name.org]

username = your_name

login_mail = your_mail

login_date = new_date



[private.data.com]

password = new_password

autoscaling = yes



[new_section]

user_port = 4098

user_request = yes

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/6.png "Example")



```python

[Common]

home_dir: /Users

library_dir: /Library

system_dir: /System

macports_dir: /opt/local



[Frameworks]

Python: 3.2

path: ${Common:system_dir}/Library/Frameworks/



[Arthur]

nickname: Two Sheds

last_name: Jackson

my_dir: ${Common:home_dir}/twosheds

my_pictures: ${my_dir}/Pictures

python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}

```





![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/7.png "Example")





### The first time you run it with a new config file, it will create a backup for the default settings:





![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/backupfiles.png "Example")





```python

from tkconfigeditor import start_config_and_load_vars, start_config



# This function opens the editor and adds the variables of the config file to the global dict. 



start_config_and_load_vars(

    cfgfile=r"C:\Users\Gamer\anaconda3\envs\dfdir\initest\cfg7.ini", # the config file, when you run it the first time, it will create a backup for the default settings

    title="Configuration", # window title

    icon=r"C:\Users\Gamer\Pictures\5.png", # needs to be png or None 

    res="1920x1080", 

    addbuttons=(), # you can add some additional buttons 

    mainlabelfont=("Helvetica", 15, "underline bold italic"),

    sublabelfont=("Helvetica", 14),

    varfont=("Helvetica", 10),

    buttonfont=("Helvetica", 12, "bold italic"),

    onezeroasboolean=True,  # 1 will be added as True to the global dict 

)



```







```python

# if you want to add a button

start_config_and_load_vars(

    cfgfile=r"C:\Users\Gamer\anaconda3\envs\dfdir\initest\cfg7.ini",

    title="Configuration",

    icon=r"C:\Users\Gamer\Pictures\5.png",

    res="1920x1080",

    addbuttons=(('Another button',lambda :os.system('start cmd')),),

    mainlabelfont=("Helvetica", 15, "underline bold italic"),

    sublabelfont=("Helvetica", 14),

    varfont=("Helvetica", 10),

    buttonfont=("Helvetica", 12, "bold italic"),

    onezeroasboolean=True,

)

```



![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/anotherbutton.png "Example")



```python



# If you don't want to add the variables of the config file to the global dict 

start_config(

    cfgfile=r"C:\Users\Gamer\anaconda3\envs\dfdir\initest\cfg7.ini",

    title="Configuration",

    icon=None,

    res="1024x768",

    addbuttons=(),

    mainlabelfont=("Helvetica", 15, "underline bold italic"),

    sublabelfont=("Helvetica", 14),

    varfont=("Helvetica", 10),

    buttonfont=("Helvetica", 12, "bold italic"),

)

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/tkconfigeditor",
    "name": "tkconfigeditor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ConfigParser,tkinter,edit",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d3/22/d0cafb5b30df1ce2881e4bda3ce8f37e2f8b69b19a24771de8218485025f/tkconfigeditor-0.12.tar.gz",
    "platform": null,
    "description": "\n# Dynamic tkinter config editor for files created with ConfigParser\n\n\n\nIf you have a friend or a client who doesn\u2019t know anything about python, but wants to change some settings without touching the py file, \n\nyou can use tkconfigeditor. Just add it on top of your python file. \n\n\n\n## pip install tkconfigeditor\n\n\n\n### Tested against Python 3.9.15 / Windows 10 / Anaconda \n\n\n\n\n\n```python\n\n[mysql]\n\nhost = localhost\n\nuser = user7\n\npasswd = s$cret\n\ndb = ydb\n\n\n\n[postgresql]\n\nhost = localhost\n\nuser = user8\n\npasswd = mypwd$7\n\ndb = testdb\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/1.png \"Example\")\n\n\n\n```python\n\n[dev]\n\napi_url = https://gorest.co.in/public/v2/users\n\nsave_dir = /Users/dradecic/Desktop/users_data\n\nsave_file = users.json\n\n\n\n[prod]\n\napi_url = https://gorest.co.in/public/v2/users\n\nsave_dir = /tmp/users_data\n\nsave_file = users.json\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/2.png \"Example\")\n\n\n\n```python\n\n[openweather]\n\napi_key = mt732wbt5kh5ea4bkw7qytbb9gdkaew4\n\n\n\n[twitter]\n\nconsumer_key = d53Qe4uf5LMWuQeQFFG66n6BN\n\nconsumer_secret = Yxf5n2BwnRELRrkkVjWgpTu48sz5KwGD52324PuwkFWdmVGP4m\n\naccess_token = 9922431-d53Qe4uf5LMWuQeQFFG66n6BN\n\naccess_token_secret = ubfWMR8WYucrzeaQdrqkm6SrhYTMVQSsxZWpNbtUCMX5u\n\n\n\n[google]\n\napi_key = ubfWMR8WYucrzeaQdrqkm6SrhYTMVQSsxZWpNbtUCMX5u\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/3.png \"Example\")\n\n\n\n\n\n```python\n\n[book]\n\ntitle: The Python Standard Library\n\nauthor: Fredrik Lundh\n\nemail: fredrik@pythonware.com\n\nversion: 2.0-001115\n\n\n\n[ematter]\n\npages: 250\n\n\n\n[hardcopy]\n\npages: 350\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/4.png \"Example\")\n\n\n\n\n\n```python\n\n[DEFAULT]\n\nserverthreads = 45\n\ncontent_type = text/html\n\ncontent_length = 1024\n\nautoscaling = no\n\n\n\n[website_name.org]\n\nusername = your_name\n\nlogin_mail = your_mail\n\n\n\n[private.data.com]\n\npassword = secret_password\n\nautoscaling = yes\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/5.png \"Example\")\n\n\n\n```python\n\n[DEFAULT]\n\nserverthreads = 45\n\ncontent_type = text/html\n\ncontent_length = 1024\n\nautoscaling = no\n\n\n\n[website_name.org]\n\nusername = your_name\n\nlogin_mail = your_mail\n\nlogin_date = new_date\n\n\n\n[private.data.com]\n\npassword = new_password\n\nautoscaling = yes\n\n\n\n[new_section]\n\nuser_port = 4098\n\nuser_request = yes\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/6.png \"Example\")\n\n\n\n```python\n\n[Common]\n\nhome_dir: /Users\n\nlibrary_dir: /Library\n\nsystem_dir: /System\n\nmacports_dir: /opt/local\n\n\n\n[Frameworks]\n\nPython: 3.2\n\npath: ${Common:system_dir}/Library/Frameworks/\n\n\n\n[Arthur]\n\nnickname: Two Sheds\n\nlast_name: Jackson\n\nmy_dir: ${Common:home_dir}/twosheds\n\nmy_pictures: ${my_dir}/Pictures\n\npython_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}\n\n```\n\n\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/7.png \"Example\")\n\n\n\n\n\n### The first time you run it with a new config file, it will create a backup for the default settings:\n\n\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/backupfiles.png \"Example\")\n\n\n\n\n\n```python\n\nfrom tkconfigeditor import start_config_and_load_vars, start_config\n\n\n\n# This function opens the editor and adds the variables of the config file to the global dict. \n\n\n\nstart_config_and_load_vars(\n\n    cfgfile=r\"C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\initest\\cfg7.ini\", # the config file, when you run it the first time, it will create a backup for the default settings\n\n    title=\"Configuration\", # window title\n\n    icon=r\"C:\\Users\\Gamer\\Pictures\\5.png\", # needs to be png or None \n\n    res=\"1920x1080\", \n\n    addbuttons=(), # you can add some additional buttons \n\n    mainlabelfont=(\"Helvetica\", 15, \"underline bold italic\"),\n\n    sublabelfont=(\"Helvetica\", 14),\n\n    varfont=(\"Helvetica\", 10),\n\n    buttonfont=(\"Helvetica\", 12, \"bold italic\"),\n\n    onezeroasboolean=True,  # 1 will be added as True to the global dict \n\n)\n\n\n\n```\n\n\n\n\n\n\n\n```python\n\n# if you want to add a button\n\nstart_config_and_load_vars(\n\n    cfgfile=r\"C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\initest\\cfg7.ini\",\n\n    title=\"Configuration\",\n\n    icon=r\"C:\\Users\\Gamer\\Pictures\\5.png\",\n\n    res=\"1920x1080\",\n\n    addbuttons=(('Another button',lambda :os.system('start cmd')),),\n\n    mainlabelfont=(\"Helvetica\", 15, \"underline bold italic\"),\n\n    sublabelfont=(\"Helvetica\", 14),\n\n    varfont=(\"Helvetica\", 10),\n\n    buttonfont=(\"Helvetica\", 12, \"bold italic\"),\n\n    onezeroasboolean=True,\n\n)\n\n```\n\n\n\n![Example](https://github.com/hansalemaos/screenshots/raw/main/tkconfigedit/anotherbutton.png \"Example\")\n\n\n\n```python\n\n\n\n# If you don't want to add the variables of the config file to the global dict \n\nstart_config(\n\n    cfgfile=r\"C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\initest\\cfg7.ini\",\n\n    title=\"Configuration\",\n\n    icon=None,\n\n    res=\"1024x768\",\n\n    addbuttons=(),\n\n    mainlabelfont=(\"Helvetica\", 15, \"underline bold italic\"),\n\n    sublabelfont=(\"Helvetica\", 14),\n\n    varfont=(\"Helvetica\", 10),\n\n    buttonfont=(\"Helvetica\", 12, \"bold italic\"),\n\n)\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Dynamic tkinter config editor for files created with ConfigParser",
    "version": "0.12",
    "split_keywords": [
        "configparser",
        "tkinter",
        "edit"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa193565bcef48c0aae53a75b78af26ae9d773c054d0fd8bf243b48f8152b552",
                "md5": "9207a2ef137e30f820f01252fce5c6f3",
                "sha256": "bfc50dac8759c477d6a098bb9ccffb29beb1176b97b0060a319f8a410685c947"
            },
            "downloads": -1,
            "filename": "tkconfigeditor-0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9207a2ef137e30f820f01252fce5c6f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11718,
            "upload_time": "2023-03-16T20:21:54",
            "upload_time_iso_8601": "2023-03-16T20:21:54.953832Z",
            "url": "https://files.pythonhosted.org/packages/fa/19/3565bcef48c0aae53a75b78af26ae9d773c054d0fd8bf243b48f8152b552/tkconfigeditor-0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d322d0cafb5b30df1ce2881e4bda3ce8f37e2f8b69b19a24771de8218485025f",
                "md5": "e343e056f6251e980debad0b54226467",
                "sha256": "bcc12b28fa725937d1337f6258a05536b233cc71f1778b492e06c4a16b6202e0"
            },
            "downloads": -1,
            "filename": "tkconfigeditor-0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "e343e056f6251e980debad0b54226467",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11181,
            "upload_time": "2023-03-16T20:21:56",
            "upload_time_iso_8601": "2023-03-16T20:21:56.709397Z",
            "url": "https://files.pythonhosted.org/packages/d3/22/d0cafb5b30df1ce2881e4bda3ce8f37e2f8b69b19a24771de8218485025f/tkconfigeditor-0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-16 20:21:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "tkconfigeditor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "tkconfigeditor"
}
        
Elapsed time: 0.05562s