本文整理汇总了Python中qtconsole.rich_jupyter_widget.RichJupyterWidget方法的典型用法代码示例。如果您正苦于以下问题:Python rich_jupyter_widget.RichJupyterWidget方法的具体用法?Python rich_jupyter_widget.RichJupyterWidget怎么用?Python rich_jupyter_widget.RichJupyterWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtconsole.rich_jupyter_widget
的用法示例。
在下文中一共展示了rich_jupyter_widget.RichJupyterWidget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def initialize(self, argv=None):
self.init_qt_app()
super(JupyterQtConsoleApp, self).initialize(argv)
if self._dispatching:
return
# handle deprecated renames
for old_name, new_name in [
('IPythonQtConsoleApp', 'JupyterQtConsole'),
('IPythonWidget', 'JupyterWidget'),
('RichIPythonWidget', 'RichJupyterWidget'),
]:
cfg = self._deprecate_config(self.config, old_name, new_name)
if cfg:
self.update_config(cfg)
JupyterConsoleApp.initialize(self,argv)
self.init_qt_elements()
self.init_signal()
示例2: __init__
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def __init__(self):
# Create an in-process kernel
self.kernel_manager = QtInProcessKernelManager()
self.kernel_manager.start_kernel()
self.kernel = self.kernel_manager.kernel
self.kernel_client = self.kernel_manager.client()
self.kernel_client.start_channels()
control = RichIPythonWidget()
control.kernel_manager = self.kernel_manager
control.kernel_client = self.kernel_client
control.exit_requested.connect(self.stop)
self.setCentralWidget(control)
示例3: initialize
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def initialize(self, argv=None):
self._init_asyncio_patch()
self.init_qt_app()
super(JupyterQtConsoleApp, self).initialize(argv)
if self._dispatching:
return
# handle deprecated renames
for old_name, new_name in [
('IPythonQtConsoleApp', 'JupyterQtConsole'),
('IPythonWidget', 'JupyterWidget'),
('RichIPythonWidget', 'RichJupyterWidget'),
]:
cfg = self._deprecate_config(self.config, old_name, new_name)
if cfg:
self.update_config(cfg)
JupyterConsoleApp.initialize(self,argv)
self.init_qt_elements()
self.init_signal()
示例4: show
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def show():
global ipython_widget # Prevent from being garbage collected
# Create an in-process kernel
kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel(show_banner=False)
kernel = kernel_manager.kernel
kernel.gui = 'qt4'
kernel_client = kernel_manager.client()
kernel_client.start_channels()
ipython_widget = RichJupyterWidget()
ipython_widget.kernel_manager = kernel_manager
ipython_widget.kernel_client = kernel_client
ipython_widget.show()
示例5: closeEvent
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def closeEvent(self, event):
"""Clean up the integrated console in napari."""
if self.kernel_client is not None:
self.kernel_client.stop_channels()
if self.kernel_manager is not None and self.kernel_manager.has_kernel:
self.kernel_manager.shutdown_kernel()
# RichJupyterWidget doesn't clean these up
self._completion_widget.deleteLater()
self._call_tip_widget.deleteLater()
self.deleteLater()
event.accept()
示例6: _plain_changed
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def _plain_changed(self, name, old, new):
kind = 'plain' if new else 'rich'
self.config.ConsoleWidget.kind = kind
if new:
self.widget_factory = JupyterWidget
else:
self.widget_factory = RichJupyterWidget
# the factory for creating a widget
示例7: make_jupyter_widget_with_kernel
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def make_jupyter_widget_with_kernel():
"""Start a kernel, connect to it, and create a RichJupyterWidget to use it
"""
kernel_manager = QtKernelManager(kernel_name=USE_KERNEL)
kernel_manager.start_kernel()
kernel_client = kernel_manager.client()
kernel_client.start_channels()
jupyter_widget = RichJupyterWidget()
jupyter_widget.kernel_manager = kernel_manager
jupyter_widget.kernel_client = kernel_client
return jupyter_widget
示例8: __init__
# 需要导入模块: from qtconsole import rich_jupyter_widget [as 别名]
# 或者: from qtconsole.rich_jupyter_widget import RichJupyterWidget [as 别名]
def __init__(self, layout, sim, gui):
# Create an in-process kernel
self.kernel_manager = QtInProcessKernelManager()
# self.kernel_manager = QtKernelManager()
self.kernel_manager.start_kernel()
self.kernel = self.kernel_manager.kernel
# self.kernel.shell.write("Welcome to AO Sim!\n")
config = sim.config
#Pass some useful objects to the user
usefulObjects = { "sim" : sim,
"gui" : gui,
"config" : config,
"simConfig" : sim.config.sim,
"telConfig" : sim.config.tel,
"atmosConfig" : sim.config.atmos,
"np" : numpy,
"plt" : pyplot
}
for i in range(sim.config.sim.nGS):
usefulObjects["wfs{}Config".format(i)] = sim.config.wfss[i]
for i in range(sim.config.sim.nDM):
usefulObjects["dm{}Config".format(i)] = sim.config.dms[i]
for i in range(sim.config.sim.nSci):
usefulObjects["sci{}Config".format(i)] = sim.config.scis[i]
self.kernel.shell.push(usefulObjects)
self.kernel_client = self.kernel_manager.client()
self.kernel_client.start_channels()
control = RichIPythonWidget()
control.kernel_manager = self.kernel_manager
control.kernel_client = self.kernel_client
control.exit_requested.connect(self.stop)
layout.addWidget(control)
# self.kernel.shell.ex("")