Skip to content

Commit 5d63825

Browse files
committed
Implement DialogBox.__repr__.
1 parent e8a277a commit 5d63825

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/monologue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def main(win):
2323
curses.init_pair(2, curses.COLOR_CYAN, 0)
2424

2525
textbox = DialogBox(1, 1, # Position 1;1 in win.
26-
30, 6, # Height and width of textbox.
26+
30, 5, # Height and width of textbox.
2727
"Tim-ats", # Title of textbox.
2828
1) # Curses color_pair used to colored title.
2929

visualdialog/dialog.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
pos_y: int,
4343
height: int,
4444
width: int,
45-
title: str = "",
45+
title: Optional = None,
4646
title_colors_pair_nb: int = 0,
4747
title_text_attr: Union[CursesTextAttribute,
4848
CursesTextAttributes] = curses.A_BOLD,
@@ -66,7 +66,11 @@ def __init__(
6666

6767
self.text_wrapper = textwrap.TextWrapper(width=self.nb_char_max_line)
6868

69-
def __enter__(self):
69+
def __repr__(self) -> str:
70+
"""Return repr(self)."""
71+
return f"DialogBox(title={self.title})"
72+
73+
def __enter__(self) -> "DialogBox":
7074
return self
7175

7276
def __exit__(self, type, value, traceback):

0 commit comments

Comments
 (0)