Example #1
0
def initialize_settings():
    #create instance of settings manager
    settings = SettingsManager("settings.json")

    #initialize settings

    #debug
    settings.add_setting("debug", "Display extra debuging output on screen?",
                         "False", ("True", "False"))

    #orientation
    orientation_setting_description = "This flips the map and the tokens so they are facing players\n"
    orientation_setting_description += "that are sitting across from the dm.\n"
    orientation_setting_description += "It also displays messages on all 4 sides of the screen facing outward,\n"
    orientation_setting_description += "instead of just one at the bottom."
    settings.add_setting("table_top_orientation",
                         orientation_setting_description, "False",
                         ("True", "False"))

    #return the settings manager
    return settings
from settings_manager import SettingsManager, SettingsManagerFrame
import tkinter as tk
from tkinter import ttk

s = SettingsManager("settings.json")

s.add_setting("debug",
              "should the application produce extra debugging output?",
              "False", ("True", "False"))
s.add_setting("width", "width? i dont know how to do ranges", "640",
              ("range", "100", "1000"))
s.add_setting("height", "description for height", "480",
              ("range", "100", "1000"))
s.add_setting("test", "a test setting.\nthis description has a new line in it",
              "abc", ("abc", "123", "456", "789"))
s.add_setting(
    "test2",
    "just adding another setting\nto see if adding a new one works after\neverythuing is in place",
    "abc", ("abc", "123", "456", "789"))

#s.print_test()

root = tk.Tk()

frame = SettingsManagerFrame(root, s)

frame.pack()

root.mainloop()