By combining tight-binding modelling with density functional theory based first-principles calculations, we investigate the band evolution of two-dimensional (2D) hexagonal lattices with (px, py) orbitals, focusing on the electronic structures and topological phase transitions. The (px, py)-orbital hexagonal lattice model possesses two flat bands encompassing two linearly dispersive Dirac bands. Breaking the A/B sublattice symmetry could transform the model into two triangular lattices, each featuring a flat band and a dispersive band. Inclusion of the spin-orbit coupling and magnetization may give rise to quantum spin Hall (QSH) and quantum anomalous Hall (QAH) states. As a proof of concept, we demonstrate that half-hydrogenated stanene is encoded by a triangular lattice with (px, py) orbitals, which exhibits ferromagnetism and QAH effect with a topological gap of ~0.15 eV, feasible for experimental observation. These results provide fundamental insights into the structure-property relationships involving the orbital degree of freedom, which may shed light on future design and preparation of 2D topological materials for novel electronic/spintronic and quantum computing devices.