Python curses.ungetmouse() Examples
The following are 5
code examples of curses.ungetmouse().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
curses
, or try the search function
.
Example #1
Source File: test_screen.py From asciimatics with Apache License 2.0 | 5 votes |
def _inject_mouse(screen, x, y, button): """ Inject a mouse event into the input buffers. """ if sys.platform == "win32": event = win32console.PyINPUT_RECORDType(win32console.MOUSE_EVENT) event.MousePosition.X = x event.MousePosition.Y = y if button & MouseEvent.LEFT_CLICK != 0: event.ButtonState |= win32con.FROM_LEFT_1ST_BUTTON_PRESSED if button & MouseEvent.RIGHT_CLICK != 0: event.ButtonState |= win32con.RIGHTMOST_BUTTON_PRESSED if button & MouseEvent.DOUBLE_CLICK != 0: event.EventFlags |= win32con.DOUBLE_CLICK screen._stdin.WriteConsoleInput([event]) else: # Curses doesn't like no value in some cases - use a dummy button # click which we don't use instead. bstate = curses.BUTTON4_CLICKED if button & MouseEvent.LEFT_CLICK != 0: bstate |= curses.BUTTON1_CLICKED if button & MouseEvent.RIGHT_CLICK != 0: bstate |= curses.BUTTON3_CLICKED if button & MouseEvent.DOUBLE_CLICK != 0: bstate |= curses.BUTTON1_DOUBLE_CLICKED curses.ungetmouse(0, x, y, 0, bstate)
Example #2
Source File: wgwidget.py From apple_bleee with GNU General Public License v3.0 | 5 votes |
def h_exit_mouse(self, _input): mouse_event = self.parent.safe_get_mouse_event() if mouse_event and self.intersted_in_mouse_event(mouse_event): self.handle_mouse_event(mouse_event) else: if mouse_event and self._test_safe_to_exit(): curses.ungetmouse(*mouse_event) ch = self.parent.curses_pad.getch() assert ch == curses.KEY_MOUSE self.editing = False self.how_exited = EXITED_MOUSE
Example #3
Source File: wgwidget.py From HomePWN with GNU General Public License v3.0 | 5 votes |
def h_exit_mouse(self, _input): mouse_event = self.parent.safe_get_mouse_event() if mouse_event and self.intersted_in_mouse_event(mouse_event): self.handle_mouse_event(mouse_event) else: if mouse_event and self._test_safe_to_exit(): curses.ungetmouse(*mouse_event) ch = self.parent.curses_pad.getch() assert ch == curses.KEY_MOUSE self.editing = False self.how_exited = EXITED_MOUSE
Example #4
Source File: wgwidget.py From EDCOP with Apache License 2.0 | 5 votes |
def h_exit_mouse(self, _input): mouse_event = self.parent.safe_get_mouse_event() if mouse_event and self.intersted_in_mouse_event(mouse_event): self.handle_mouse_event(mouse_event) else: if mouse_event and self._test_safe_to_exit(): curses.ungetmouse(*mouse_event) ch = self.parent.curses_pad.getch() assert ch == curses.KEY_MOUSE self.editing = False self.how_exited = EXITED_MOUSE
Example #5
Source File: wgwidget.py From TelegramTUI with MIT License | 5 votes |
def h_exit_mouse(self, _input): mouse_event = self.parent.safe_get_mouse_event() if mouse_event and self.intersted_in_mouse_event(mouse_event): self.handle_mouse_event(mouse_event) else: if mouse_event and self._test_safe_to_exit(): curses.ungetmouse(*mouse_event) ch = self.parent.curses_pad.getch() assert ch == curses.KEY_MOUSE self.editing = False self.how_exited = EXITED_MOUSE