Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/textual/pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ async def mouse_down(
shift: bool = False,
meta: bool = False,
control: bool = False,
button: int = 1,
) -> bool:
"""Simulate a [`MouseDown`][textual.events.MouseDown] event at a specified position.

Expand All @@ -121,6 +122,7 @@ async def mouse_down(
shift: Simulate the event with the shift key held down.
meta: Simulate the event with the meta key held down.
control: Simulate the event with the control key held down.
button: The mouse button to press.

Raises:
OutOfBounds: If the position for the event is outside of the (visible) screen.
Expand All @@ -134,7 +136,7 @@ async def mouse_down(
[MouseMove, MouseDown],
widget=widget,
offset=offset,
button=1,
button=button,
shift=shift,
meta=meta,
control=control,
Expand Down Expand Up @@ -195,6 +197,7 @@ async def click(
meta: bool = False,
control: bool = False,
times: int = 1,
button: int = 1,
) -> bool:
"""Simulate clicking with the mouse at a specified position.

Expand Down Expand Up @@ -222,6 +225,7 @@ async def click(
meta: Click with the meta key held down.
control: Click with the control key held down.
times: The number of times to click. 2 will double-click, 3 will triple-click, etc.
button: The mouse button to click.

Raises:
OutOfBounds: If the position to be clicked is outside of the (visible) screen.
Expand All @@ -235,7 +239,7 @@ async def click(
[MouseDown, MouseUp, Click],
widget=widget,
offset=offset,
button=1,
button=button,
shift=shift,
meta=meta,
control=control,
Expand All @@ -251,6 +255,7 @@ async def double_click(
shift: bool = False,
meta: bool = False,
control: bool = False,
button: int = 1,
) -> bool:
"""Simulate double clicking with the mouse at a specified position.

Expand Down Expand Up @@ -279,6 +284,7 @@ async def double_click(
shift: Click with the shift key held down.
meta: Click with the meta key held down.
control: Click with the control key held down.
button: The mouse button to click.

Raises:
OutOfBounds: If the position to be clicked is outside of the (visible) screen.
Expand All @@ -287,7 +293,9 @@ async def double_click(
`True` if no selector was specified or if the selected widget was under the mouse
when the click was initiated. `False` is the selected widget was not under the pointer.
"""
return await self.click(widget, offset, shift, meta, control, times=2)
return await self.click(
widget, offset, shift, meta, control, times=2, button=button
)

async def triple_click(
self,
Expand All @@ -296,6 +304,7 @@ async def triple_click(
shift: bool = False,
meta: bool = False,
control: bool = False,
button: int = 1,
) -> bool:
"""Simulate triple clicking with the mouse at a specified position.

Expand Down Expand Up @@ -324,6 +333,7 @@ async def triple_click(
shift: Click with the shift key held down.
meta: Click with the meta key held down.
control: Click with the control key held down.
button: The mouse button to click.

Raises:
OutOfBounds: If the position to be clicked is outside of the (visible) screen.
Expand All @@ -332,7 +342,9 @@ async def triple_click(
`True` if no selector was specified or if the selected widget was under the mouse
when the click was initiated. `False` is the selected widget was not under the pointer.
"""
return await self.click(widget, offset, shift, meta, control, times=3)
return await self.click(
widget, offset, shift, meta, control, times=3, button=button
)

async def hover(
self,
Expand Down
Loading