我具有以下快捷方式配置,在Jupiter Notebook单元中运行快捷方式后即可使用:
%%javascript
IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-q', {
help: 'Clear all output', // This text will show up on the help page (CTRL-M h or ESC h)
handler: function (event) { // Function that gets invoked
if (IPython.notebook.mode == 'command') {
IPython.notebook.clear_all_output();
return false;
}
return true;
}
});
如何设置Jupiter Notebook在启动时自动进行初始化?
我尝试添加相同的代码(不带%%javascript
),C:\Users\<username>\.ipython\profile_default\static\custom\custom.js
但是没有用。
我只有一个配置文件,使用ipython profile create
Python 3.3,Windows 7创建。
提前致谢。
custom.js是此代码的正确位置。尝试按以下方式包装它(不要忘记代码return true
块结尾之前的):
$([IPython.events]).on("app_initialized.NotebookApp", function () {
<your code>
return true;
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句