MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / __init__

Method __init__

dm_control/viewer/gui/glfw_gui.py:175–200  ·  view source on GitHub ↗

Instance initializer. Args: width: Initial window width, in pixels. height: Initial window height, in pixels. title: A string with a window title. context: (Optional) A `render.GLFWContext` instance. Raises: RuntimeError: If GLFW initialization or window initi

(self, width, height, title, context=None)

Source from the content-addressed store, hash-verified

173 """
174
175 def __init__(self, width, height, title, context=None):
176 """Instance initializer.
177
178 Args:
179 width: Initial window width, in pixels.
180 height: Initial window height, in pixels.
181 title: A string with a window title.
182 context: (Optional) A `render.GLFWContext` instance.
183
184 Raises:
185 RuntimeError: If GLFW initialization or window initialization fails.
186 """
187 super().__init__()
188 self._context = context or DoubleBufferedGlfwContext(width, height, title)
189
190 if not self._context.window:
191 raise RuntimeError('Failed to create window')
192
193 self._oldsize = None
194
195 with self._context.make_current() as ctx:
196 self._fullscreen_quad = ctx.call(self._glfw_setup, self._context.window)
197 self.on_files_drop = util.QuietSet()
198
199 self._keyboard = GlfwKeyboard(self._context)
200 self._mouse = GlfwMouse(self._context)
201
202 def _glfw_setup(self, window):
203 glfw.set_drop_callback(window, self._handle_file_drop)

Callers

nothing calls this directly

Calls 6

GlfwKeyboardClass · 0.85
GlfwMouseClass · 0.85
make_currentMethod · 0.80
__init__Method · 0.45
callMethod · 0.45

Tested by

no test coverage detected