Skip to content

Conversation

PedroManuelAtienzaHuerta

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.

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.
Copy link
Owner

@sebe324 sebe324 left a 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.

  1. For some reason the layout is not working correctly:
    obraz

  2. 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.

element.update(background_color=theme['input'][1], text_color=theme['input'][0])

# Create the window
window = sg.Window('Calculator', layout, finalize=True)
Copy link
Owner

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

# Apply initial light theme
apply_theme(window, light_mode)

while True:
Copy link
Owner

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.
@sebe324
Copy link
Owner

sebe324 commented Feb 11, 2025

Hi, I still get this when I try to run this app:

obraz

I can't really accept the pr, because it looks broken.
Also in the previous versions some of the buttons were different colors (DEL, AC, OFF <-, ->), but now all have the same color, because of the simple loop approach coloring all buttons the same color.
Have you tried to run the app locally on your machine? How does it look? Make sure everything works correctly before commiting changes.
Regards,
Sebastian

Fixed bug with button colors and tested code for errors.
@PedroManuelAtienzaHuerta
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants