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

Render a Triangle

Render a Triangle

Rendering Points

Rendering Points

Lights

Lights

Offscreen Rendering

Offscreen Rendering

Clipping Planes

Clipping Planes

Orbit Camera

Orbit Camera

Geometry Image

Geometry Image

Show Image

Show Image

Line Drawing Performance

Line Drawing Performance

Torus knot

Torus knot

Flat Shading

Flat Shading

Line Segments

Line Segments

Fly controller

Fly controller

Point Picking

Point Picking

Gizmo to transform world objects

Gizmo to transform world objects

Volume Slice 1

Volume Slice 1

Geometry Plane

Geometry Plane

Bounding Box Coordinates

Bounding Box Coordinates

Text contrast

Text contrast

Wireframe 1

Wireframe 1

Thick Lines

Thick Lines

Klein Bottle Geometry

Klein Bottle Geometry

Stats helper (Manual)

Stats helper (Manual)

Wireframe 2

Wireframe 2

Volume Slice 2

Volume Slice 2

Volume Slice 3

Volume Slice 3

Image with Points Overlaid

Image with Points Overlaid

Use a Skybox

Use a Skybox

Volume Rendering 2

Volume Rendering 2

Physical Color

Physical Color

Panzoom Camera

Panzoom Camera

Instancing

Instancing

Synced Video Rendering

Synced Video Rendering

Color Picking

Color Picking

Sphere Geometry

Sphere Geometry

Directional Shadow 1

Directional Shadow 1

Mesh Slice Material

Mesh Slice Material

Paint to a texture

Paint to a texture

Volume Rendering 1

Volume Rendering 1

Image with another image overlaid

Image with another image overlaid

Scene Overlay

Scene Overlay

Text snake

Text snake

Subplots 1

Subplots 1

Use a Skybox

Use a Skybox

Transparency 1

Transparency 1

Nested Scenes

Nested Scenes

PBR Rendering 1

PBR Rendering 1

Mesh and Volume Slicing 2

Mesh and Volume Slicing 2

Transparency 2

Transparency 2

Types of Cylinders

Types of Cylinders

Mesh Picking

Mesh Picking

Volume and Mesh Slicing 1

Volume and Mesh Slicing 1

Lightmap

Lightmap

Dynamic Environment Map

Dynamic Environment Map

Ambient occlusion

Ambient occlusion

Image Click Events

Image Click Events

Directional Shadow 2

Directional Shadow 2

Subplots 2

Subplots 2

Colormap Image

Colormap Image

Subplots Video

Subplots Video

Minimal Custom Object

Minimal Custom Object

PBR Rendering 2

PBR Rendering 2

Environment Map Effects

Environment Map Effects

Text waterfall

Text waterfall

Line Drawing

Line Drawing

Mesh with quads

Mesh with quads

Map Screen to World

Map Screen to World

Colormap Mesh

Colormap Mesh

Multi-Object Selection

Multi-Object Selection

Depth Material

Depth Material

Simple Custom Object

Simple Custom Object

Spotlights

Spotlights

Spotlight Shadow

Spotlight Shadow

Text align

Text align

Wireframe Material

Wireframe Material

Custom Object

Custom Object

Axes Helper 1

Axes Helper 1

Box Geometry

Box Geometry

Axis Helper 2

Axis Helper 2

Image Material

Image Material

Simple Colormap

Simple Colormap

Image on Plane Geometry 1

Image on Plane Geometry 1

Normals on front and back

Normals on front and back

Lines with different thicknesses

Lines with different thicknesses

Points with different sizes

Points with different sizes

Depth Overlay 2

Depth Overlay 2

Depth Overlay 1

Depth Overlay 1

Reference Color

Reference Color

Transparency

Transparency

Text anchor

Text anchor

Points with different markers

Points with different markers

Dashing

Dashing

Light and Shadow

Light and Shadow

Validate Skybox

Validate Skybox

Depth Clipping

Depth Clipping

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering

Text justification

Text justification

NDC Coordinates

NDC Coordinates

Text size

Text size

Lines in 2D

Lines in 2D

Points drawn with different size_space

Points drawn with different size_space

Mesh Colormaps

Mesh Colormaps

Lines drawn with different thickness_space

Lines drawn with different thickness_space

Culling

Culling

Mesh slice

Mesh slice