##// END OF EJS Templates
Shaperilio/qtgui fixes (#13957)...
Shaperilio/qtgui fixes (#13957) I started using the released version of my `PySide6`-enabling changes and noted some problems. In this PR, I fix those, and also overall improve the feedback to the user when a GUI event loop is hooked in: - Report which event loop is running when using `%gui <some GUI>`; e.g. `%gui qt` will show `Installed qt6 event loop hook.` - Report when the event loop is disabled; i.e. `%gui` will show `GUI event loop hook disabled.` if an event loop hook was installed, or `No event loop hook running.` if nothing was installed. - Requesting a second event loop will give the message `Shell is already running a gui event loop for <some GUI>. Call with no arguments to disable current loop.` - Requesting a different version of Qt, i.e. `%gui qt6` followed by `%gui` followed by `%gui qt5` will show `Cannot switch Qt versions for this session; will use qt6.` followed by `Installed qt6 event loop hook.` (Fixes / improves #13864)

File last commit:

r20547:8f4e2b41
r28163:88d1fedc merge
Show More
Raw Input in the Notebook.ipynb
151 lines | 5.9 KiB | text/plain | TextLexer
/ examples / IPython Kernel / Raw Input in the Notebook.ipynb

Using raw_input and %debug in the Notebook

The Notebook has added support for raw_input and %debug, as of 1.0.

In [1]:
# Python 3 compat
import sys
if sys.version_info[0] >= 3:
    raw_input = input
In [2]:
name = raw_input("What is your name? ")
name
What is your name? Sir Robin
Out[2]:
'Sir Robin'
In [3]:
def div(x, y):
    return x/y

div(1,0)
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-4-a5097cc0c0c5> in <module>()
      2     return x/y
      3 
----> 4 div(1,0)

<ipython-input-4-a5097cc0c0c5> in div(x, y)
      1 def div(x, y):
----> 2     return x/y
      3 
      4 div(1,0)

ZeroDivisionError: division by zero
In [4]:
%debug
> <ipython-input-4-a5097cc0c0c5>(2)div()
      1 def div(x, y):
----> 2     return x/y
      3 

ipdb> x
1
ipdb> y
0
ipdb> bt
  <ipython-input-4-a5097cc0c0c5>(4)<module>()
      1 def div(x, y):
      2     return x/y
      3 
----> 4 div(1,0)

> <ipython-input-4-a5097cc0c0c5>(2)div()
      1 def div(x, y):
----> 2     return x/y
      3 
      4 div(1,0)

ipdb> exit