Skip to content

Commit 6a10ba9

Browse files
committed
update image widget repr
1 parent fd36a64 commit 6a10ba9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ipywidgets/widgets/widget_media.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,10 @@ def _get_repr(self, cls):
117117
# Return value first like a ValueWidget
118118
signature = []
119119

120-
# strip off the starting b' and ending ' so we can truncate if needed
121-
sig_value = repr(self.value[:100].tobytes())[2:-1]
122-
123-
if self.value.nbytes > 100:
124-
sig_value += '...'
125-
signature.append("{}=b'{}'".format('value', sig_value))
120+
sig_value = 'value={!r}'.format(self.value[:100].tobytes())
121+
if len(sig_value) > 120:
122+
sig_value = sig_value[:-1]+"..."+sig_value[-1]
123+
signature.append(sig_value)
126124

127125
for key in super(cls, self)._repr_keys():
128126
if key == 'value':

0 commit comments

Comments
 (0)