GUI-based Python code generator extension for Jupyter Lab, Jupyter Notebook, and Google Colab
—
Interactive panel component that provides the main Visual Python GUI interface within JupyterLab, extending Lumino's Panel widget with Visual Python-specific functionality.
Main Visual Python panel component extending Lumino Panel for JupyterLab integration.
/**
* Visual Python panel component for JupyterLab
* Extends Lumino Panel with Visual Python functionality
*/
class VpPanel extends Panel {
constructor(app: JupyterLab);
onResize(msg: ResizeMessage): void;
onBeforeShow(): void;
onAfterHide(): void;
onAfterAttach(): void;
onCloseRequest(msg: CloseRequestMessage): void;
}Creates a new Visual Python panel instance with JupyterLab integration.
/**
* Creates Visual Python panel with application reference
* @param app - JupyterLab application instance
*/
constructor(app: JupyterLab);Parameters:
app: JupyterLab application instance for accessing shell, commands, and servicesDescription: Initializes the Visual Python panel with:
'jupyterlab-visualpython:panel')Usage Example:
import { VpPanel } from './VpPanel.js';
// Create panel during extension activation
const vpPanel = new VpPanel(app);
app.shell.add(vpPanel, 'right');Panel lifecycle methods handling visibility, attachment, and sizing events.
/**
* Handles panel resize events and adjusts internal frame dimensions
* @param msg - Resize message containing new dimensions
*/
onResize(msg: ResizeMessage): void;Description: Responds to panel size changes by:
Parameters:
msg: Resize message object containing dimension information/**
* Executed before panel becomes visible
* Shows VP wrapper and initializes Visual Python interface
*/
onBeforeShow(): void;Description: Prepares panel for display by:
/**
* Executed after panel is hidden
* Hides VP wrapper and cleans up interface
*/
onAfterHide(): void;Description: Handles panel hiding by:
/**
* Called after panel is attached to DOM
* Triggers Visual Python frame attachment
*/
onAfterAttach(): void;Description: Handles panel DOM attachment by:
/**
* Handles panel close request and disposes resources
* @param msg - Close request message
*/
onCloseRequest(msg: CloseRequestMessage): void;Description: Manages panel cleanup during close by:
Parameters:
msg: Close request message objectCore properties providing panel configuration and state management.
// Panel properties
app: JupyterLab; // Application reference
vpFrame: VpFrameObject; // Visual Python frame component
id: string; // Panel identifier
title: TitleObject; // Panel title configurationProperty Details:
app
JupyterLabvpFrame
VpFrameObjectid
string'jupyterlab-visualpython:panel'title
TitleObjectThe panel integrates with a Visual Python frame component that provides the core visual programming interface.
// Frame integration methods
vpFrame.afterAttach(): void; // Called after panel DOM attachment
vpFrame.resize(): void; // Handles frame resizing
vpFrame.show(): void; // Shows Visual Python interface
vpFrame.hide(): void; // Hides Visual Python interfaceThe panel communicates with the Visual Python frame through:
The panel integrates with JupyterLab's shell system:
// Panel added to right sidebar
app.shell.add(vpPanel, 'right');
// Panel visibility management
if (vpPanel.isVisible) {
vpPanel.hide();
} else {
vpPanel.show();
}The panel handles various JupyterLab events:
The panel works with CodeMirror for code editing functionality:
// CodeMirror integration for code generation
const editor = CodeMirror.fromTextArea(textarea, {
mode: 'python',
theme: 'default'
});// Panel-related types
interface ResizeMessage extends Message {
width: number;
height: number;
}
interface CloseRequestMessage extends Message {
// Close request message properties
}
interface VpFrameObject {
afterAttach(): void;
resize(width: number, height: number): void;
show(): void;
hide(): void;
}
interface TitleObject {
label: string;
icon: string;
caption: string;
}Install with Tessl CLI
npx tessl i tessl/pypi-jupyterlab-visualpython