##// END OF EJS Templates
Removed the timer callback in favor of the idle one and re-use wx waiting time after an event is processed. This make things more reactive. Also, the created window is now made insivisible and is not supposed to be ever show or detroyed. Finally, fixed the bug in window closing for linux platform using the glutSetOption available on Freeglut.
Removed the timer callback in favor of the idle one and re-use wx waiting time after an event is processed. This make things more reactive. Also, the created window is now made insivisible and is not supposed to be ever show or detroyed. Finally, fixed the bug in window closing for linux platform using the glutSetOption available on Freeglut.

File last commit:

r4125:fa42ce72
r4831:c6756143
Show More
example-embed-short.py
47 lines | 1.8 KiB | text/x-python | PythonLexer
/ docs / examples / core / example-embed-short.py
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 """Quick code snippets for embedding IPython into other programs.
See example-embed.py for full details, this file has the bare minimum code for
cut and paste use once you understand how to use the system."""
#---------------------------------------------------------------------------
# This code loads IPython but modifies a few things if it detects it's running
# embedded in another IPython session (helps avoid confusion)
try:
MinRK
update embedding doc to reflect new API
r4124 get_ipython
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 except NameError:
MinRK
update embedding doc to reflect new API
r4124 banner=exit_msg=''
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 else:
banner = '*** Nested interpreter ***'
exit_msg = '*** Back in main IPython ***'
MinRK
update embedding doc to reflect new API
r4124 # First import the embed function
from IPython.frontend.terminal.embed import InteractiveShellEmbed
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 # Now create the IPython shell instance. Put ipshell() anywhere in your code
# where you want it to open.
MinRK
update embedding doc to reflect new API
r4124 ipshell = InteractiveShellEmbed(banner1=banner, exit_msg=exit_msg)
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0
#---------------------------------------------------------------------------
# This code will load an embeddable IPython shell always with no changes for
# nested embededings.
MinRK
update embedding doc to reflect new API
r4124 from IPython import embed
# Now embed() will open IPython anywhere in the code.
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0
#---------------------------------------------------------------------------
# This code loads an embeddable shell only if NOT running inside
# IPython. Inside IPython, the embeddable shell variable ipshell is just a
# dummy function.
try:
MinRK
update embedding doc to reflect new API
r4124 get_ipython
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 except NameError:
MinRK
update embedding doc to reflect new API
r4124 from IPython.frontend.terminal.embed import InteractiveShellEmbed
ipshell = InteractiveShellEmbed()
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 # Now ipshell() will open IPython anywhere in the code
else:
# Define a dummy ipshell() so the same code doesn't crash inside an
# interactive IPython
def ipshell(): pass
#******************* End of file <example-embed-short.py> ********************