I think many sites say to use hat boxes because they are generally smoother and a little more tailored looking (if you paint them it also looks incredibly smooth).
To answer your first question, how are you going to get the cards out of it?
A. I would say on this picture the bottom layer is where the hat box comes in. The lid (striped portion) probably has a hole cut into it so the cards can fall down, when you’re ready to collect the cards you just lift the lid up. That way you don’t ruin the box.
You next question is how to keep the opening secure? I’m not really sure what you mean, If you cut a hole large enough in the box for the card to fall into everything should be fine.
I don’t think there’s really a way to put a lock onto this sort of box. If you’re worries about security you could secure the lid (again the striped portion of the bottom layer) down with some twist ties (when you’re ready untwist them to get to your cards) or you could do a simpler box (square with a card slot) that you can just cut open with you want to get the cards out.
The best sort of glue to use for this would be hot glue in my opinion. You would have to be careful how you did this though- I would stretch the fabric over the box and then glue it where people wouldn’t see (like inside the box). If you want to attach everything onto the cardboard I’ve heard contact cement in a spray form.
First, you must seal the fabric so it does not soak up all the cement like a sponge, which can be done by various items found at Joann’s Fabric.
Getting some fabric stiffener would not hurt either, as it makes cutting the fabric precisely much easier.
Spray both the side of the box & the fabric with the contact glue, allow to dry, then very carefully lay the fabric over the cardboard a little at a tme ( as you only get one shot at getting it right ), spreading out the frabric flat as you go along.
Allow some overlap ( which you can always trim off later ), as this way, you know you will not end up with any bare spots showing along the edges.
Do a side at a time until you have effectively covered the entire surface & allow 24 hours to dry, after which, you can then apply fabric sealant if the fabric is decorated, or paint if not.
You might want to consider doing this part outside, as the fumes will about kill you & anything else that breaths in the house.