MCPcopy
hub / github.com/Textualize/textual / hover

Method hover

src/textual/pilot.py:349–381  ·  view source on GitHub ↗

Simulate hovering with the mouse cursor at a specified position. The final position to be hovered is computed based on the selector provided and the offset specified and it must be within the visible area of the screen. Args: widget: A widget or selector used as

(
        self,
        widget: Widget | type[Widget] | str | None | None = None,
        offset: tuple[int, int] = (0, 0),
    )

Source from the content-addressed store, hash-verified

347 )
348
349 async def hover(
350 self,
351 widget: Widget | type[Widget] | str | None | None = None,
352 offset: tuple[int, int] = (0, 0),
353 ) -> bool:
354 """Simulate hovering with the mouse cursor at a specified position.
355
356 The final position to be hovered is computed based on the selector provided and
357 the offset specified and it must be within the visible area of the screen.
358
359 Args:
360 widget: A widget or selector used as an origin
361 for the hover offset. If this is not specified, the offset is interpreted
362 relative to the screen. You can use this parameter to try to hover a
363 specific widget. However, if the widget is currently hidden or obscured by
364 another widget, the hover may not land on the widget you specified.
365 offset: The offset to hover. The offset is relative to the widget / selector provided
366 or to the screen, if no selector is provided.
367
368 Raises:
369 OutOfBounds: If the position to be hovered is outside of the (visible) screen.
370
371 Returns:
372 True if no selector was specified or if the hover landed on the selected
373 widget, False otherwise.
374 """
375 # This is usually what the user wants because it gives time for the mouse to
376 # "settle" before moving it to the new hover position.
377 await self.pause()
378 try:
379 return await self._post_mouse_events([MouseMove], widget, offset, button=0)
380 except OutOfBounds as error:
381 raise error from None
382
383 async def _post_mouse_events(
384 self,

Calls 2

pauseMethod · 0.95
_post_mouse_eventsMethod · 0.95