It turns out that pixel_to_world is implemented in Web VPython but not in the vpython module which, as you say, returns zero. This wasn't noticed because you might be the first person to try to use it.
That's the bad news. The good news is that here is the JavaScript pixel_to_world function, which you can easily emulate::
// Convert number of pixels into distance in real-world coordinates
var w = this.__width // e.g. scene.width
var h = this.__height // e.g. scene.height
var d = 2*this.range // e.g 2*scene.range
if (w >= h) {
return d/h
} else {
return d/w
}
Note that the scene.camera functions in that Help page may also be useful to you.