def OnCreate(self, event):
     tab_name = self.tctrl.GetValue()
     tab_icon = bitmap_loader.getImage("ship_small", "icons")
     self.notebook.AddPage(
         title=tab_name,
         image=tab_icon if self.icon_check.GetValue() else None,
         closeable=self.close_check.GetValue())
    def __init__(self):
        """Renders the add tab button"""
        self.add_img = bitmap_loader.getImage("ctabadd", "icons")
        self.width = self.add_img.GetWidth()
        self.height = self.add_img.GetHeight()

        self.region = None
        self.tbmp = wx.Bitmap(self.add_img)
        self.add_bitmap = None

        self.position = (0, 0)
        self.highlighted = False

        self.InitRenderer()
    def __init__(self, size=(36, 24), text=wx.EmptyString, img: wx.Image=None,
                 closeable=True):

        # tab left/right zones inclination
        self.ctab_left = bitmap_loader.getImage("ctableft", "icons")
        self.ctab_middle = bitmap_loader.getImage("ctabmiddle", "icons")
        self.ctab_right = bitmap_loader.getImage("ctabright", "icons")
        self.ctab_close = bitmap_loader.getImage("ctabclose", "icons")

        self.left_width = self.ctab_left.GetWidth()
        self.right_width = self.ctab_right.GetWidth()
        self.middle_width = self.ctab_middle.GetWidth()
        self.close_btn_width = self.ctab_close.GetWidth()

        width, height = size

        self.min_width = self.left_width + self.right_width + self.middle_width
        self.min_height = self.ctab_middle.GetHeight()

        # set minimum width and height to what is allotted to images
        width = max(width, self.min_width)
        height = max(height, self.min_height)

        self.text = text
        self.tab_size = (width, height)
        self.closeable = closeable
        self.selected = False
        self.close_btn_hovering = False
        self.tab_bitmap = None
        self.tab_back_bitmap = None
        self.padding = 4
        self.font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False)

        self.tab_img = img
        self.position = (0, 0)  # Not used internally for rendering - helper for tab container
        self.InitTab()