Metadata-Version: 2.1
Name: basic_options
Version: 0.0.6
Summary: This package provides a basic way to create configuration files, especially for tkinter GUI applictions.
Author: DuncanRuns
License: MIT License
        
        Copyright (c) 2020 DuncanRuns
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/DuncanRuns/basic_options
Project-URL: Bug Tracker, https://github.com/DuncanRuns/basic_options/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# Basic Options

This package provides a basic way to create configuration files, especially for tkinter GUI applictions.


```python
# EXAMPLE USAGE

# Create an options class inheriting BasicOptions, and override the _set_defaults function
class ExampleOptions(BasicOptions):
    def _set_defaults(self):
        self.value_a = 1
        self.valueB = "2"
        self.c = [3, 4, 5]
        self.delta = 6.0
        self.Eee = {"value": 7}

# Create an instance of the options
example = ExampleOptions()

# Change a value in the options using .set_option() or item notation
example["delta"] += 0.6666
# You can do `example.delta += 0.6666`, however that would not activate the wrappers from .set_option_wrappers()

# Retreiving options can be done with .get_option(), or item notation
print(example.get_option("delta"))
print(example["c"])

# Loading and saving options can be done easily with .save_file() and .load_file()
# example2 = ExampleOptions().load_file("old_save.json").
# example2.save_file("new_save.json")
# Retreiving dictionaries and json strings with .to_json() and .to_dict()
```
