i dont have a stand-alone-script which you can run right away.
but here’s a snippset from the login-screen of an old game of mine which should be pretty much the thing you’r looking for.
btw… never mind that there is a frame and a bg-frame. the frame is my topmost gui-element so i can delete all guy’s with one destroy() call. the bg.frame contained the menu-background image.
def loginScreen(self):
self.frame = DirectFrame(
frameColor=(0,0,0,0),
frameSize=(-1,1,-1,1))
self.bgFrame = DirectFrame(
frameColor=(0,0,0,0),
frameSize=(-1,1,-1,1),
sortOrder=1)
self.bgFrame.reparentTo(self.frame)
self.unEntry = DirectEntry(initialText="Username",
scale=0.05,
text_scale=(1,1),
pos=(-.56,0,-0.57),
frameColor=(1,1,1,0.1))
self.unEntry.reparentTo(self.frame)
self.pwEntry = DirectEntry(
initialText="Password",
scale=0.05,
text_scale=(1,1),
pos=(-.56,0,-.71),
frameColor=(1,1,1,0.1),
obscured=1)
self.pwEntry.reparentTo(self.frame)
self.loginbutton = DirectButton(text = "> Login <",
pos=(0.13,0,-.57),
scale=0.06,
command=self.login)
self.loginbutton.reparentTo(self.frame)
def login(self):
print self.unEntry.get(), self.pwEntry.get()
self.frame.destroy()