Entering non-Strings into DirectEntry

As far as I can see, DirectEntry allows only for entering Strings.

However, I’d like to build an editor where I can enter values of types: string, None/False/True, tuples, integers … and maybe others.

So I guess I will enter stuff like:


As far as I can see I could grab the string from the DirectEntry and use


Usually this is not recommended for security reasons, but this should not be an issue here since this is an editor that only I would use.

Still, would this be the way to go?

I don’t see why not, since you’ve already acknowledged the potential security concerns. This just gives you a way to type arbitrary Python code into your DirectEntry.


Only don’t forget an all-catching try…except around the eval.