Under Gnome, I'm using this at the beginning of a sh source block:

 echo -e "#! /bin/bash\n/usr/bin/gksudo -p -m Password" > /tmp/gksudo-stdout
 chmod +x /tmp/gksudo-stdout
 SUDO_ASKPASS="/tmp/gksudo-stdout" sudo -A -s


Sylvain.