This repository was archived by the owner on Dec 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
GUI
RedDeadDepresso edited this page Nov 9, 2023
·
1 revision
Here's a brief overview of how it works:
- It loads the
config.jsonfile into a variable calledconfig_dataand creates a copy of it with all values set toNone, storing them in a variable calledwidgets. - Customtkinter widgets are defined with a command that calls the
save_to_jsonfunction, and as they are created, they are added to thewidgetsvariable. - It loads
config_dataintowidgetsby accessing the same key in both dictionaries and setting the customtkinter widget to the respective value inconfig_data. - It saves user input by doing the reverse of the previous step: extracting the value from the customtkinter widget, changing the respective value in
config_data, and then savingconfig.json.
As for displaying script output, it uses a specific widget called CTkTextbox stored in a variable called self.log_textbox. You can define tags to set the color of the text. When you click the start button in the sidebar, it runs script.py as a separate process and starts another thread to analyze its standard output. If it finds specific words using a dictionary called self.log_level_colors (associating words with tags), it will display the line with the specified color; otherwise, it will ignore it.