pygfx.objects.RootEventHandler

class pygfx.objects.RootEventHandler(*args, **kwargs)

Bases: EventTarget

Pygfx event handler.

Root event handler for the Pygfx event system.

dispatch_event(event: Event)

Dispatch the given event.

This method will dispatch an event by looking for the right target to handle the event. When a target is set on the event, then that target will be the first object that gets to handle the event. From there it will ask its parents one-by-one to handle the event as long as the event bubbles / propagates up or is not cancelled.

The RootEventHandler object will serve as a virtual root for the tree hierarchy.

Whenever an object has captured the pointer (for a specific pointer_id) then that object will get all pointer related events until the object releases the capture or a pointer_up event is encountered.

This method will also keep track of pointer_down and pointer_up events in order to generate and dispatch click and double_click events.

Parameters:

event (Event) – The event to dispatch.

Examples

Animation Mixer

Animation Mixer

Anisotropy Barn Lamp

Anisotropy Barn Lamp

Ambient occlusion

Ambient occlusion

Clearcoat effect

Clearcoat effect

Clearcoat effect

Clearcoat effect

Colormap Image

Colormap Image

Colormap Mesh

Colormap Mesh

Minimal Custom Object

Minimal Custom Object

Simple Custom Object

Simple Custom Object

Custom Object

Custom Object

Types of Cylinders

Types of Cylinders

Dynamic Environment Map

Dynamic Environment Map

Earth

Earth

Environment Map Effects

Environment Map Effects

Flat Shading

Flat Shading

Fly controller

Fly controller

Geometry Image

Geometry Image

Klein Bottle Geometry

Klein Bottle Geometry

Geometry Plane

Geometry Plane

Torus knot

Torus knot

Animations with glTF

Animations with glTF

glTF Unlit Material Example

glTF Unlit Material Example

Gizmo to transform world objects

Gizmo to transform world objects

Stats helper (Manual)

Stats helper (Manual)

Image Click Events

Image Click Events

Image with another image overlaid

Image with another image overlaid

Image with Points Overlaid

Image with Points Overlaid

Displaying an image in a scene

Displaying an image in a scene

Instancing

Instancing

Iridescence Abalone

Iridescence Abalone

Iridescence

Iridescence

Labelled Image Grid

Labelled Image Grid

Directional Shadow 1

Directional Shadow 1

Directional Shadow 2

Directional Shadow 2

Spotlight Shadow

Spotlight Shadow

Spotlights

Spotlights

Lightmap

Lightmap

Line Drawing

Line Drawing

Line Drawing Performance

Line Drawing Performance

Line plot

Line plot

Line Segments

Line Segments

Thick Lines

Thick Lines

Map Screen to World

Map Screen to World

Measure distances in 2D

Measure distances in 2D

Measure distances in 3D

Measure distances in 3D

Depth Material

Depth Material

Mesh Slice Material

Mesh Slice Material

Toon Rendering 1

Toon Rendering 1

Toon Rendering 2

Toon Rendering 2

Facecap animation with morph targets

Facecap animation with morph targets

Morph Targets

Morph Targets

Multi-Object Selection

Multi-Object Selection

Volume and Mesh Slicing 1

Volume and Mesh Slicing 1

Mesh and Volume Slicing 2

Mesh and Volume Slicing 2

Multiple Fonts

Multiple Fonts

Paint to a texture

Paint to a texture

Paint to a texture directly

Paint to a texture directly

Panzoom Camera

Panzoom Camera

PBR Rendering 1

PBR Rendering 1

PBR Rendering 2

PBR Rendering 2

PBR Instanced Rendering

PBR Instanced Rendering

Physical Color

Physical Color

Color Picking

Color Picking

Mesh Picking

Mesh Picking

Point Picking

Point Picking

Point Markers with Multiple Colors

Point Markers with Multiple Colors

Mesh with quads

Mesh with quads

Camera linking 1

Camera linking 1

Camera linking 2

Camera linking 2

Nested Scenes

Nested Scenes

Scene Overlay

Scene Overlay

Subplots 1

Subplots 1

Subplots 2

Subplots 2

Subplots Video

Subplots Video

Sheen Chair

Sheen Chair

Glam Velvet Sofa

Glam Velvet Sofa

Show Image

Show Image

Skinned Mesh

Skinned Mesh

Skinning Animation

Skinning Animation

Detached Bind Mode

Detached Bind Mode

Use a Skybox

Use a Skybox

Use a Skybox

Use a Skybox

Sphere Geometry

Sphere Geometry

Synced Video Rendering

Synced Video Rendering

Text align

Text align

Big static text

Big static text

Text contrast

Text contrast

Text multiple grid

Text multiple grid

Text multiple labels

Text multiple labels

Text snake

Text snake

Text waterfall

Text waterfall

Transparency 1

Transparency 1

Transparency 2

Transparency 2

Video YUV

Video YUV

Isosurface Volume Rendering

Isosurface Volume Rendering

Minip Volume Rendering

Minip Volume Rendering

Volume Rendering 1

Volume Rendering 1

Volume Rendering 2

Volume Rendering 2

Volume Slice 1

Volume Slice 1

Volume Slice 2

Volume Slice 2

Volume Slice 3

Volume Slice 3

Wireframe 1

Wireframe 1

Wireframe 2

Wireframe 2

Wireframe Material

Wireframe Material

Bounding Box Coordinates

Bounding Box Coordinates

Clipping Planes

Clipping Planes

Render a Triangle

Render a Triangle

Lights

Lights

Offscreen Rendering

Offscreen Rendering

Orbit Camera

Orbit Camera

Rendering Points

Rendering Points

A Method to Subtract Background from an Image

A Method to Subtract Background from an Image

A Tool to Compare Two Images of Identical Shapes

A Tool to Compare Two Images of Identical Shapes

Image Histogram Analysis

Image Histogram Analysis

Additive Blending

Additive Blending

Validate transparency with and without bg

Validate transparency with and without bg

Validate dither

Validate dither

Validate transparency for the ordered2 blend mode

Validate transparency for the ordered2 blend mode

Validate weighted_plus

Validate weighted_plus

Box Geometry

Box Geometry

Reference Color

Reference Color

Culling

Culling

Depth Clipping

Depth Clipping

Depth Overlay 1

Depth Overlay 1

Depth Overlay 2

Depth Overlay 2

Validate the grid

Validate the grid

Axes Helper 1

Axes Helper 1

Axis Helper 2

Axis Helper 2

Image on Plane Geometry 1

Image on Plane Geometry 1

Image Material

Image Material

Validate Colormap

Validate Colormap

Light and Shadow

Light and Shadow

Lines in 2D

Lines in 2D

Dashing

Dashing

Infinite line segments

Infinite line segments

Line loop

Line loop

Lines with different thicknesses

Lines with different thicknesses

Lines drawn with different thickness_space

Lines drawn with different thickness_space

Mesh Colormaps

Mesh Colormaps

Mesh slice

Mesh slice

NDC Coordinates

NDC Coordinates

Normals on front and back

Normals on front and back

Points with different markers

Points with different markers

Points with different sizes

Points with different sizes

Points drawn with different size_space

Points drawn with different size_space

Validate ruler

Validate ruler

Validate send_data

Validate send_data

Validate Skybox

Validate Skybox

srgb texture colorspace

srgb texture colorspace

Text alignment

Text alignment

Text anchor

Text anchor

Text direction

Text direction

Text markdown formatting

Text markdown formatting

Text outline always behind text itself

Text outline always behind text itself

Text size

Text size

Tiny Image Validation

Tiny Image Validation

Validate transforms

Validate transforms

Validate view offset

Validate view offset

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering