TP-2Bz, as a nucleus targeting “D–π–A” molecule, was developed as a two-photon turn-on fluorescent probe for the viscosity and GQ DNA detection in cell nuclei.