You could add a bool variable, for example "pressed_via_code", and set it to true right before setting CheckBox.Pressed = true. Then you'd be able to check this bool within your event.
func _on_CheckBox_pressed():
if pressed_via_code:
pressed_via_code = false
return
else:
do_stuff()
Of course this will only work if you have the bool and the event within the same script. Otherwise you'll need a reference/connection to the corresponding script.