We present an explicit formula for the Stokes automorphism acting on the topological string partition function. When written in terms of the dual partition function, our formula implies that flat coordinates in topological string theory transform as quantum periods, and according to the Delabaere-Dillinger-Pham formula. We first show how the formula follows from the non-linear Stokes phenomenon of the Painlevé I equation, together with the connection between its $\tau$-function and topological strings on elliptic curves. Then, we show that this formula is also a consequence of a recent conjecture on the resurgent structure of the topological string, based on the holomorphic anomaly equations, and it is in fact valid for arbitrary Calabi-Yau threefolds.