如何跳转到Jupyter笔记本中当前正在运行的单元? [英] How can I jump to the cell currently being run in a Jupyter notebook?
问题描述
在Jupyter笔记本中选择run all
,run all above
或run all below
之后,如何跳转到当前正在运行的单元格?
After I select run all
, run all above
, or run all below
in a Jupyter notebook, how can I jump to the cell currently being run?
推荐答案
谢谢您的想法,亚伦.但它在整个运行过程中只能运行一次,因此需要对其进行改进以使其更加有用.
Thank you for this idea, Aaron. But it works only once on a full run, so it needs to be improved to be more useful.
我已将其扩展为可以在笔记本执行期间多次使用的快捷方式.
I have expanded it into a shortcut that can be used many times during the execution of the notebook.
将此添加到~/.jupyter/custom/custom.js
:
// Go to Running cell shortcut
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('Alt-I', {
help : 'Go to Running cell',
help_index : 'zz',
handler : function (event) {
setTimeout(function() {
// Find running cell and click the first one
if ($('.running').length > 0) {
//alert("found running cell");
$('.running')[0].scrollIntoView();
}}, 250);
return false;
}
});
现在,您可以随时按Alt-I
键,以使笔记本将视图重新聚焦到运行的单元格上.
Now you can press Alt-I
any time to have the notebook refocus the view on to the running cell.
接下来,最好编写一个扩展/快捷方式,以在所有执行期间使当前运行单元格的视图保持焦点.
Next it'd be nice to write an extension/shortcut that keeps the current running cell's view in focus during all of execution.
这篇关于如何跳转到Jupyter笔记本中当前正在运行的单元?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!