I want to know with the raspberry pi if the button is clicked.
I want ot use the button of the GPIOZERO python library.
The power plug is a 12v power plug.
Can this circuit work?
(I'm a beginner.)
When the button is pressed the red side of the button will be at 0V. But when the button is released it will go to 12V and fry your RPi. Also 0V for the power plug can differ from 0V for the RPi. If they differ too much that fries the RPI as well.
So first thing you have to fix is to connect the GND of the power plug and RPi so they both agree what 0V is.
Next you need a voltage divider (just 2 large resistors in series) going from the red side of the button to GND. Picking the right resistors you would get a 3.3V signal in between the two resistors and you can connect that to a GPIO pin. But that would also create a leak across the button. A small current would flow even with the button off. So not really the best solution.
A better solution would be to add an octocoupler in series with the button. Adjust the resistor and/or diode in the circuit to offset the voltage loss through the octocoupler. The other side of the octocoupler is then connected to GND and a GPIO pin and the GPIO pin is set to input with pullup.