Press the tofu for 10 to 20 minutes to remove excess moisture. Place the tofu between layers of paper towel or a clean kitchen towel. Set a cutting board on top and weigh it down with something heavy, like a cast iron pan or a few cookbooks.
In a small bowl, whisk together the rice vinegar, ketchup, brown sugar, 1 tablespoon soy sauce, and water. In a separate cup, mix 1 tablespoon of cornstarch with 2 tablespoons water to form a slurry. Stir in the Szechuan pepper, if using.
Cut the pressed tofu into 1-inch cubes. Toss with 2 tablespoons soy sauce and 1 tablespoon cornstarch until evenly coated.
Heat the oil in a large nonstick or cast iron skillet over medium-high heat. Add the tofu and cook for 6–8 minutes, turning occasionally, until golden brown and crisp. Transfer to a plate and set aside.
In the same pan, add the onion and cook for 1 minute. Add the red bell pepper and cook for another 1–2 minutes, until just starting to soften.
Stir in the pineapple, then pour in the sweet and sour sauce. Simmer for 1 minute. Stir the cornstarch slurry again and add it to the pan. Cook, stirring constantly, for 1–2 minutes, until the sauce thickens.
Return the tofu to the pan and toss to coat in the sauce. Cook for another minute until heated through.
Spoon over cooked white rice and garnish with green onions. Best enjoyed immediately.