why cant i type into a direct entry

Why cant i type into a direct entry that is parented to render2d (instead of normal aspect2d) ???

I need to use entry in my own GUI and i dont want to mess with reset aspect2d (as i did before) i just create my own gui2d node that fulfills the same function…

any why here is the code straight form the manual except parent=render2d. I need to find out why it does not work!

import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText 
from direct.gui.DirectGui import *
from pandac.PandaModules import *

#add some text
bk_text = "This is my Demo"
textObject = OnscreenText(text = bk_text, pos = (0.95,-0.95), 
scale = 0.07,fg=(1,0.5,0.5,1),align=TextNode.ACenter,mayChange=1)

#callback function to set  text 
def setText(textEntered):

#clear the text
def clearText():

#add button
b = DirectEntry(text = "" ,scale=.05,command=setText,parent=render2d,
initialText="Type Something", numLines = 2,focus=1,focusInCommand=clearText)

#run the tutorial

I think it has to do some thing with the PGTop

Class : PGTop
Description : The "top" node of the new Panda GUI system. This node must be parented to the 2-d scene graph, and all PG objects should be parented to this node or somewhere below it. PG objects not parented within this hierarchy will not be clickable.
This node begins the special traversal of the PG objects that registers each node within the MouseWatcher and forces everything to render in a depth-first, left-to-right order, appropriate for 2-d objects.

When i try to create 2 PGTop objects one for panda’s gui and one for mine i get this:

Assertion failed: _watcher_group != (PGMouseWatcherGroup *)NULL at line 102 of panda/src/pgui/pgTop.I
Assertion failed: _watcher_group != (PGMouseWatcherGroup *)NULL at line 102 of panda/src/pgui/pgTop.I
Assertion failed: _watcher_group != (PGMouseWatcherGroup *)NULL at line 102 of panda/src/pgui/pgTop.I
Assertion failed: _watcher_group != (PGMouseWatcherGroup *)NULL at line 102 of panda/src/pgui/pgTop.I

I also tried deleting the aspect2d


it gets removed form the scene graph but i still have the same problem with a single PGTop

The mousewatcherstuff only listens for mouse/kbd events in the top node of the 2d scenegraph – which is aspect2d. Render2d is just reparented to aspect2d. (or the other way around, I don’t remember. Someone correct me if I’m wrong.)
If I recall correctly, someone here made a hack to solve that (I think it was ynjh_jo), I believe he made both nodes a PGTop() node.

it’s there :

Thanks ill try this out!

Right, there’s no reason you can’t have two PGTop nodes. Or just one, which is also the unscaled scene graph root if you like. You just have to remember to assign the MouseWatcher pointer when you create a new PGTop node.

Note that you can also implement a DirectEntry node in your own gui by listening for the “keystroke” event, and handling backspace and whatnot all by yourself.


I think panda3d entry is pretty good. I just liked my stuff themed with tiled and/or stretched textures with borders and stuff, and have a hierarchical mouse click system.