Test scrolling with the mouse
This commit is contained in:
parent
0a104afd4a
commit
f02b8a7791
2 changed files with 8 additions and 1 deletions
|
|
@ -33,6 +33,13 @@ class TestWidget(urwid.WidgetWrap):
|
|||
elif key == "down":
|
||||
self.lines.upper_offset -= 1
|
||||
|
||||
def mouse_event(self, size, event, button, col, row, focus):
|
||||
if event == "mouse press":
|
||||
if button == 4:
|
||||
self.lines.upper_offset += 1
|
||||
if button == 5:
|
||||
self.lines.upper_offset -= 1
|
||||
|
||||
def main():
|
||||
screen = urwid.curses_display.Screen()
|
||||
palette = [
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestWidget(urwid.WidgetWrap):
|
|||
self.text.set_text("\n".join(self.last_keys))
|
||||
|
||||
def mouse_event(self, size, event, button, col, row, focus):
|
||||
self.last_keys.append(f"{size!r} {event!r} {button!r} ({row}, {col})")
|
||||
self.last_keys.append(f"{event!r} {button!r} ({row}, {col})")
|
||||
self.last_keys = self.last_keys[-self.KEY_LIMIT:]
|
||||
self.text.set_text("\n".join(self.last_keys))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue