def _create_control(self, parent):
        """ Create the toolkit-specific control that represents the widget. """

        collapsed_carat = self.collapsed_carat_image.create_image()
        self._collapsed_bmp = collapsed_carat.ConvertToBitmap()
        self._carat_w = self._collapsed_bmp.GetWidth()

        expanded_carat = self.expanded_carat_image.create_image()
        self._expanded_bmp = expanded_carat.ConvertToBitmap()

        header_bar = self.header_bar_image.create_image()
        self._header_bmp = header_bar.ConvertToBitmap()

        header_bar_over = self.header_mouseover_image.create_image()
        self._header_mouseover_bmp = header_bar_over.ConvertToBitmap()

        self._background_bmp = self._header_bmp

        close_image = self.remove_image.create_image()
        self._remove_bmp = close_image.ConvertToBitmap()

        # create our panel and initialize it appropriately
        sizer = wx.BoxSizer(wx.VERTICAL)
        panel = wx.Panel(parent, -1, style=wx.CLIP_CHILDREN)
        panel.SetSizer(sizer)
        panel.SetAutoLayout(True)

        # needed on GTK systems for EVT_ERASE_BACKGROUND to work
        panel.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)

        # create the remove button
        remove = wx.BitmapButton(panel, -1, self._remove_bmp, style=0,
                                 pos=(-1, 3))
        sizer.Add(remove, 0, wx.ALIGN_RIGHT, 5)

        # Create a suitable font.
        self._font = new_font_like(wx.NORMAL_FONT,
                                   point_size=wx.NORMAL_FONT.GetPointSize()- 1)

        height = self._get_preferred_height(parent, self.title, self._font)
        panel.SetSize((-1, height))

        wx.EVT_ERASE_BACKGROUND(panel, self._on_erase_background)
        wx.EVT_ENTER_WINDOW(panel, self._on_enter_leave)
        wx.EVT_LEAVE_WINDOW(panel, self._on_enter_leave)
        wx.EVT_LEFT_DOWN(panel, self._on_down)
        wx.EVT_RIGHT_DOWN(panel, self._on_down)

        wx.EVT_BUTTON(panel, remove.GetId(), self._on_remove)

        return panel
dataset/ETHPy150Open enthought/pyface/pyface/expandable_header.py/ExpandableHeader._create_control/original