I’ve been wondering for some time: is there a Gui class inside panda3d that supports selectable text ? I mean that you could actually copy paste it, is there some kind of already implemented Onscreentext class that would allow me to do that ?.
Hmm… I don’t think that copy-paste is supported, but DirectEntry might be a good starting point for implementing such a thing.
Well, DirectEntry doesn’t handle selection either from what I’ve seen, it only allows you to paste text from the clipboard.
The actual question therefore is: is there a simple way to implement mouse selection and text highlighting without having to start from scratch (using bounding boxes and mouse coordinates) ?
You might be able to extend DirectEntry–at least then you have the fundaments on which to build. Through binding various events you could intercept the relevant key-strokes and update the entry as appropriate.
(Also, have you searched the forum for a similar project? It’s not impossible that someone has had a similar idea at some point in the past.
In fact, here’s a thread offering something that looks like it may do what you want:
I haven’t used it myself, so I’m not in a position to recommend for or against it, but it might be worth looking into.)
Aaah, my very first post here! Thanks for that, now I feel really old !
In case there is still some interest in it, I’ve updated the code to make it compatible with Python 3.
Thanks a lot I’ll take a look, this looks like quite a good start. Mind if I do some copy pasta ?
You’re welcome! Copy pasta with as much awesomesauce as you like .
Where’s the updated code? did you just edit the original post?
The post has indeed been edited, I’ve been able to run it on python 3