Skip to content

Commit 454f04e

Browse files
committed
Use a view attribute instead of kwarg
1 parent d623cff commit 454f04e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

stage3.0_first_views/traited_face_detect.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ class ImageFile(HasStrictTraits):
2727

2828
metadata = Dict
2929

30+
traits_view = View(
31+
Item(name='filepath', show_label=False),
32+
buttons=[OKButton],
33+
resizable=True,
34+
width=640
35+
)
36+
3037
def to_array(self):
3138
if not self.filepath:
3239
return np.array([])
@@ -74,13 +81,7 @@ def _detect_faces(self):
7481

7582
if __name__ == '__main__':
7683
img = ImageFile()
77-
view = View(
78-
Item(name='filepath', show_label=False),
79-
buttons=[OKButton],
80-
resizable=True,
81-
width=640
82-
)
83-
img.configure_traits(view=view)
84+
img.configure_traits()
8485

8586
plt.imshow(img.to_array())
8687
img_desc = plt.gca()

0 commit comments

Comments
 (0)