How to implement Python IDE to DirectGUI?

Can I have example or advice of how to implement Python IDE to DirectGUI ?

I have this code but I don’t know how I can Implement it with Direct GUI

from direct.showbase.ShowBase import ShowBase
from direct.stdpy import threading
from direct.gui.DirectGui import *
from code import InteractiveConsole

app = ShowBase()

text = DirectLabel(
    frameSize=(-0.5, 0.5, -0.5, 0.5),
    text="Hello"
)

ic = InteractiveConsole(globals())
ic_thread = threading.Thread(target=ic.interact)
ic_thread.start()
app.run()

Please help me. I really need some advice to go on.

I am also interested in doing this.

For my application, I am interested in replicating something similar to the developer console provided in PyMOL, a visualization and analysis software for molecules:

At the top of the interface you can see my type print('hello world') into the console.

Following the rabbit hole, I found this thread, where @rdb suggested looking at the developer console in the game Naith. I found the project and the relevant code.

I have not yet tried to run this code, but I’ve written this post mostly as a note for myself, so that one day I can return to this problem. If anyone in the meantime is able to produce a minimal example of a developer console using this code, please post your solution here–it would be greatly appreciated.