Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何更改python模块(TQM模块)输出的文本颜色?(因此不是python文本编辑器输出)_Python_Text_Colors - Fatal编程技术网

如何更改python模块(TQM模块)输出的文本颜色?(因此不是python文本编辑器输出)

如何更改python模块(TQM模块)输出的文本颜色?(因此不是python文本编辑器输出),python,text,colors,Python,Text,Colors,我使用谷歌Colab中的黑色主题,它可以自动将文本颜色从输出转换为白色。 然而,现在我正在使用TQM模块中的progressbar,我得到的文本是深色的,这在深色主题中是有问题的。我正在考虑Colorama,但它只会为文本编辑更改文本颜色(我想是吧?)。这是我的密码: import yahoo_fin from yahoo_fin.stock_info import get_data bar = trange(72) bar.write("Downloading data...&quo

我使用谷歌Colab中的黑色主题,它可以自动将文本颜色从输出转换为白色。 然而,现在我正在使用TQM模块中的progressbar,我得到的文本是深色的,这在深色主题中是有问题的。我正在考虑Colorama,但它只会为文本编辑更改文本颜色(我想是吧?)。这是我的密码:

import yahoo_fin
from yahoo_fin.stock_info import get_data
bar = trange(72)
bar.write("Downloading data...")
for i,stocks in zip(bar,filtered_list):
    df[stocks]= get_data(stocks,stockstart,stockend)['adjclose'].dropna()
bar.write("Completed!") 

我在Colab中遇到了这个问题,在一个单元格中运行以下代码为我解决了这个问题:

# Set the tqdm text color to white.

from IPython.display import HTML, display

def set_css_in_cell_output():
    display(HTML('''
        <style>
            .jupyter-widgets {color: #d5d5d5 !important;}
            .widget-label {color: #d5d5d5 !important;}
        </style>
    '''))

get_ipython().events.register('pre_run_cell', set_css_in_cell_output)
#将TQM文本颜色设置为白色。
从IPython.display导入HTML,显示
def set_css_in_cell_output():
显示(HTML(“”)
.jupyter小部件{color:#d5d5d5!重要;}
.widget标签{颜色:#d5d5d5!重要;}
'''))
get_ipython().events.register('pre_run_cell',set_css_in_cell_output)

(受StackOverflow答案启发)

我在Colab中遇到了这个问题,在一个单元格中运行以下代码为我解决了这个问题:

# Set the tqdm text color to white.

from IPython.display import HTML, display

def set_css_in_cell_output():
    display(HTML('''
        <style>
            .jupyter-widgets {color: #d5d5d5 !important;}
            .widget-label {color: #d5d5d5 !important;}
        </style>
    '''))

get_ipython().events.register('pre_run_cell', set_css_in_cell_output)
#将TQM文本颜色设置为白色。
从IPython.display导入HTML,显示
def set_css_in_cell_output():
显示(HTML(“”)
.jupyter小部件{color:#d5d5d5!重要;}
.widget标签{颜色:#d5d5d5!重要;}
'''))
get_ipython().events.register('pre_run_cell',set_css_in_cell_output)
(灵感来自StackOverflow答案)