Skip to content

Commit 385159f

Browse files
committed
Add current curses windows to required parameters in char_by_char and word_by_word methods.
1 parent 943c845 commit 385159f

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

visualdialog/dialog.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,12 @@ def _write_word_char_by_char(self,
304304
word: str,
305305
delay: int,
306306
random_delay: Sequence[int],
307-
callbacks: Iterable[Callable[[BaseTextBox, str, str],
308-
Optional[Any]]]):
307+
callbacks: Iterable[
308+
Callable[[BaseTextBox,
309+
CursesWindow,
310+
str,
311+
int],
312+
Optional[Any]]]):
309313
"""Write word char by char at given positon."""
310314
for x, char in enumerate(word):
311315
win.addstr(pos_y,
@@ -324,7 +328,7 @@ def _write_word_char_by_char(self,
324328
curses.napms(delay)
325329

326330
for callback in callbacks:
327-
callback(self, char, x)
331+
callback(self, win, char, x)
328332

329333
def _write_word(self,
330334
win: CursesWindow,
@@ -333,7 +337,9 @@ def _write_word(self,
333337
word: str,
334338
delay: int,
335339
random_delay: Sequence[int],
336-
callbacks: Iterable[Callable[["DialogBox", str],
340+
callbacks: Iterable[Callable[["DialogBox",
341+
CursesWindow,
342+
str],
337343
Optional[Any]]]):
338344
"""Write word at given position."""
339345
win.addstr(pos_y,
@@ -346,7 +352,7 @@ def _write_word(self,
346352
+ rand_delay)
347353

348354
for callback in callbacks:
349-
callback(self, word)
355+
callback(self, win, word)
350356

351357
def _one_by_one(self,
352358
write_method: Callable,
@@ -362,8 +368,10 @@ def _one_by_one(self,
362368
flash_screen: bool,
363369
delay: int,
364370
random_delay: Sequence[int],
365-
callbacks: Iterable[Callable[["DialogBox", str],
366-
Optional[Any]]]]):
371+
callbacks: Iterable[Callable[["DialogBox",
372+
CursesWindow,
373+
str],
374+
Optional[Any]]]):
367375
"""This method offers a general purpose API to display text
368376
regardless of whether it is written word by word or character by
369377
character.

0 commit comments

Comments
 (0)