Jupyter QtConsole:通过配置选择内置CSS之一作为默认值 [英] Jupyter QtConsole: select one of the built in CSSs as the default via configuration

查看:231
本文介绍了Jupyter QtConsole:通过配置选择内置CSS之一作为默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows中使用Jupyter. 我的意思是更改QT控制台的颜色.

I am using Jupyter in Windows. I mean to change coloring of the QT console.

如何通过配置文件选择一种内置CSS作为默认CSS?

我的意思是避免像jupyter qtconsole --style monokai中那样将其作为参数传递. 我宁愿使用配置文件,例如file1 = %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py 我最终要做的是在某些配置文件中写入monokai,并让QTconsole加载内置的monokai.

I mean to avoid passing it as an argument as in jupyter qtconsole --style monokai. I would rather use a configuration file, e.g. file1 = %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py What I ultimately want to do is write monokai in some configuration file, and have the QTconsole load the built-in monokai.

到目前为止我尝试过的事情:

What I tried so far:

  1. 作为测试,执行 jupyter qtconsole --style monokai. 它实际上带来了monokai(暗灰色bgr上的白色fgr).而且,它与我在文件1中选择的c.ConsoleWidget.font_size = 12很好地结合了.

  1. As a test, execute jupyter qtconsole --style monokai. It actually brought monokai (white fgr on dark gray bgr). Moreover, it combined well with my selected c.ConsoleWidget.font_size = 12 in file1.

然后,尝试使用自己的CSS. 我在C:\Users\user1中复制了一个monokai.css文件(我的系统中有很多文件,但是我想任何一个文件都应该适用于最基本的东西). 在file1中,我包含了其中的一行

Then, trying to use my own css. I copied a monokai.css file in C:\Users\user1 (I have quite a few in my system, but I guess any one should work for the most basic stuff). In file1 I included one of the lines

c.JupyterQtConsoleApp.stylesheet = u'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:\\Users\\user1\\monokai.css'

没有工作.

如果我进行了这项工作,我仍然必须找到如何用内置的简单CSS名称替换作为位置的文件规范.

If I made this work, I would still have to find how to replace the specification of a file as a location by a simple CSS name among the built-in.

PS:我知道我也可以设置一个启动jupyter qtconsole --style monokai的Windows快捷方式. 我也想避免这种情况.

PS: I know I could also set a Windows shortcut that launches jupyter qtconsole --style monokai. I also mean to avoid this.

推荐答案

这是一个解决方案,但我不确定它是唯一的解决方案,还是不确定它在系统之间的可移植性最强. 注意:关于此配置的工作方式,可能存在一些尚未解决的问题,请参见 https ://github.com/jupyter/qtconsole/issues/334

This is a solution, but I am not certain it is the only one, or if it is the most portable across systems. Note: there might be some issues, yet to be solved, in the way this configuration works, see https://github.com/jupyter/qtconsole/issues/334

使用

c.JupyterWidget.syntax_style = 'monokai'

在文件%USERPROFILE%\.jupyter\jupyter_qtconsole_config.py中 或~\.jupyter\jupyter_qtconsole_config.py.

的启发.

这篇关于Jupyter QtConsole:通过配置选择内置CSS之一作为默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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