One use of an operator is to "measure" (...in a mathematical treatment) a quantity. Here px applied to ψ gives a momentum along x.
Now, Heisenberg. If a particle is trapped somewhere, do you have some (imprecise) information about that particle? Is it compatible with an other information about that particle? With arbitrary precision?
And when ψ is an eigenfunction of an operator, how well is the quantity (here the momentum) measured by this operator defined?
"The wave function for particle in a one dimensional box is an eigenfunction of px2"
I doubt that in the general case. Some hypothesis may be missing there, for instance "stationary wave function", "fundamental state" or a similar one.
Do you know a quantity that resembles p2? How precisely is it defined under the previous kind of assumptions?