2

IPython qtconsole (v3.0.0) のカスタム バナーを設定しようとしています。私のプロファイル構成では、 を設定c.IPythonWidget.banner = u'Custom Banner'してから起動しipython qtconsole --profile=myprofます。私が得るのは、通常のバナーの前に追加されたカスタム バナーです。

Custom BannerPython 2.7.5 (default, Mar  9 2014, 22:15:05) 
Type "copyright", "credits" or "license" for more information.

IPython 3.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

IPython profile: myprof

In [1]: 

バナーのみを印刷するにはどうすればよいですか。

Custom Banner

IPython profile: myprof

In [1]: 

ありがとう。

4

2 に答える 2

0

不要なメッセージは、カーネルのバナー (シェルから取得) の一部として出力されます。banner1他の場所でカーネルを使用/接続する前に、シェルの属性を空の文字列に設定することで、出力を回避できました。

from IPython.qt.inprocess import QtInProcessKernelManager
kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel()
kernel_manager.kernel.shell.banner1 = ""

私はこれを IPython Qt のものでのみ使用/テストしたので、これは他のカーネルでは機能しない可能性があります。

于 2015-06-29T18:43:12.007 に答える
0

default_gui_banner=""理想的ではありませんが、IPython ソースのcore/usage.pyモジュールに設定することで、デフォルトのバナーを抑制することができました 。ソースを変更せずにこれを行う方法を見つけることができませんでした (これは醜いです)。

于 2015-05-12T20:40:03.677 に答える