I'm trying to use a GUI box to pass my password to the cryptsetup command and failing miserably

.
Anyone know how to do that?
I know that PCLOS does it at boot when you have a LUKS encrypted partition set to automount (very impressive, and the only distro I've seen that has such a cool thing), but I don't know how it's done, and I don't have an encrypted partition, just an encrypted container file - hence using cryptsetup.
I've been trying to use Xdialog, here is my code attempt:
Xdialog --password --inputbox --stdout "Enter LUKS password:" 10 60 | sudo cryptsetup create myhome /dev/loop0It work as far as it echoes my password back onto the terminal command line, but then it just sits there waiting for me to press enter (in the terminal) which completely defeats the purpose of using a GUI!
I haven't tried with zenity yet, would that be easier?
Thanks
