@@ -115,14 +115,17 @@ def to_string(_string):
115115
116116
117117class Viewer3d (Display3d ):
118- def __init__ (self , window_handle ):
118+ def __init__ (self ):
119119 Display3d .__init__ (self )
120- self ._window_handle = window_handle
120+
121+ self .Context = self .GetContext ()
122+ self .Viewer = self .GetViewer ()
123+ self .View = self .GetView ()
124+
125+ self ._window_handle = None
121126 self ._inited = False
122127 self ._local_context_opened = False
123- self .Context = None
124- self .Viewer = None
125- self .View = None
128+
126129 self .OverLayer = None
127130 self .selected_shape = None
128131 self .default_drawer = None
@@ -166,17 +169,11 @@ def FitAll(self):
166169 self .View .ZFitAll ()
167170 self .View .FitAll ()
168171
169- def Create (self , create_default_lights = True , draw_face_boundaries = True , phong_shading = True ):
170- if self ._window_handle is None :
171- self .InitOffscreen (640 , 480 )
172- self ._is_offscreen = True
173- else :
174- self .Init (self ._window_handle )
175- self ._is_offscreen = False
172+ def Create (self , wid , create_default_lights = True , draw_face_boundaries = True , phong_shading = True ):
173+ self ._window_handle = wid
174+ self .Init (self ._window_handle )
175+ self ._is_offscreen = False
176176
177- self .Context = self .GetContext ()
178- self .Viewer = self .GetViewer ()
179- self .View = self .GetView ()
180177 if create_default_lights :
181178 self .Viewer .SetDefaultLights ()
182179 self .Viewer .SetLightOn ()
0 commit comments