File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 1414from dataclasses import dataclass
1515
1616
17+ PYGFX_EVENTS = [
18+ "key_down" ,
19+ "key_up" ,
20+ "pointer_down" ,
21+ "pointer_move" ,
22+ "pointer_up" ,
23+ "pointer_enter" ,
24+ "pointer_leave" ,
25+ "click" ,
26+ "double_click" ,
27+ "wheel" ,
28+ "close" ,
29+ "resize" ,
30+ ]
31+
32+
1733class BaseGraphic :
1834 def __init_subclass__ (cls , ** kwargs ):
1935 """set the type of the graphic in lower case like "image", "line_collection", etc."""
@@ -27,10 +43,6 @@ def __init_subclass__(cls, **kwargs):
2743
2844
2945class Graphic (BaseGraphic ):
30- pygfx_events = [
31- "click"
32- ]
33-
3446 def __init__ (
3547 self , name : str = None ):
3648 """
@@ -104,7 +116,7 @@ def link(
104116 callback : callable = None ,
105117 bidirectional : bool = False
106118 ):
107- if event_type in self . pygfx_events :
119+ if event_type in PYGFX_EVENTS :
108120 self .world_object .add_event_handler (self .event_handler , event_type )
109121
110122 # make sure event is valid
@@ -117,7 +129,7 @@ def link(
117129 feature_instance .add_event_handler (self .event_handler )
118130
119131 else :
120- raise ValueError (f"Invalid event, valid events are: { self . pygfx_events + self .feature_events } " )
132+ raise ValueError (f"Invalid event, valid events are: { PYGFX_EVENTS + self .feature_events } " )
121133
122134 # make sure target feature is valid
123135 if feature is not None :
You can’t perform that action at this time.
0 commit comments