-
Notifications
You must be signed in to change notification settings - Fork 2
Update layouts.py #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Update layouts.py #26
Conversation
Hi, my name is Pedro Manuel, I have modified the script to introduce the following changes: - Added styles for light and dark modes. - Updated layout to support mode switching. - Implemented logic to switch between light and dark modes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for your contribution!
Unfortunately I've encountered some errors when trying to run this code.
-
The file layouts.py should not contain the window definition and the while true loop. Check comments for more info
If those two things are fixed then I'll accept the pr, but now it does not really work.
src/python/layouts.py
Outdated
element.update(background_color=theme['input'][1], text_color=theme['input'][0]) | ||
|
||
# Create the window | ||
window = sg.Window('Calculator', layout, finalize=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The window shouldn't be created in the layouts.py file. It is already created in CalculatorUI.py where it handles all the logic
src/python/layouts.py
Outdated
# Apply initial light theme | ||
apply_theme(window, light_mode) | ||
|
||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop is also defined already in CalculatorUI.py.
If you want to for example test if this python module works use
if __name__ == "__main__":
, so the code does not run when it is imported in another file.
This change will ensure that the window creation and event loop in `layouts.py` are used only for testing when the module is run directly. When imported into `CalculatorUI.py`, this code will not run.
Hi, I still get this when I try to run this app: I can't really accept the pr, because it looks broken. |
Fixed bug with button colors and tested code for errors.
I can't run the code locally because I don't have a computer. If there are any more errors, I'll try to fix them as best I can. Sorry for the inconvenience. |
Hi, my name is Pedro Manuel, I have modified the script to introduce the following changes: