ipython笔记本工具栏自定义 [英] ipython notebook toolbar customize

查看:125
本文介绍了ipython笔记本工具栏自定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ipython笔记本上添加一个新的工具栏按钮。我得到了一个很好的链接

I want to add a new toolbar button on ipython notebook. I got a good link mentioned this.

所以我创建了一个新文件:〜/ .ipython / profile_default / static / custom / custom.js,内容低于

So I create a new file: ~/.ipython/profile_default/static/custom/custom.js with below content

    $([IPython.events]).on('notebook_loaded.Notebook', function(){
    IPython.toolbar.add_buttons_group([
        {
             'label'   : 'run qtconsole',
             'icon'    : 'ui-icon-calculator', // select your icon from http://jqueryui.com/themeroller/
             'callback': function(){IPython.notebook.kernel.execute('%qtconsole')}
        }
        // add more button here if needed.
        ]);
    });

重启ipython笔记本并加载ipython文档。
我可以看到工具栏右侧的一个按钮。

The restart ipython notebook and load the ipython document. I can see one button at the right of the toolbar.

此问题是图标似乎无法正确显示。

This issue is the icon seems not displayed correctly.

但我想它应该看起来像ui-icon-calculator。

But I guess it should looks like ui-icon-calculator.

ui-icon-calculator可以在 themeroller 但我不确定是否需要将其下载到本地磁盘。

The ui-icon-calculator can be found at themeroller but I am not sure if I need to download it to local disk.

推荐答案

该文件已过期。 jQuery的UI图标不再可用,而不是使用一个从 FontAwesome 与IPython的> = 1.0。请参阅此文件以及使用IPython 1.x的示例custom.js。

That doc is out of date. jquery-ui icons are no longer available, instead use one from FontAwesome with IPython >= 1.0. See this file for an example custom.js with IPython 1.x.

这篇关于ipython笔记本工具栏自定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆