def test_lib_floatcanvas_fc_scaledtextbox(self):
        fccanvas = fc.FloatCanvas(self.frame)

        obj = fc.ScaledTextBox("some text", (2, 2), 100)

        fccanvas.AddObject(obj)
        fccanvas.Destroy()
Exemple #2
0
    def __init__(self, type, XY, text, id):
        self.Links = []
        self.XY = XY
        self.ID = id

        # Set box color based on model type
        imgs_base_path = os.environ['APP_IMAGES_PATH']
        if type == datatypes.ModelTypes.TimeStep:
            bmp = wx.Image(path.join(imgs_base_path, 'E.png'),
                           wx.BITMAP_TYPE_PNG)
        elif type == datatypes.ModelTypes.FeedForward:
            bmp = wx.Image(path.join(imgs_base_path, 'B.png'),
                           wx.BITMAP_TYPE_PNG)
        elif type == datatypes.ModelTypes.Data:
            bmp = wx.Image(path.join(imgs_base_path, 'N.png'),
                           wx.BITMAP_TYPE_PNG)
        else:  # default type
            bmp = wx.Image(path.join(imgs_base_path, 'M.png'),
                           wx.BITMAP_TYPE_PNG)

        self.box = FC.Bitmap(bmp, XY, Position="cc", InForeground=True)
        self.Width = bmp.Width
        self.Height = bmp.Height

        font = wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_NORMAL)
        font_size = 15
        self.label = FC.ScaledTextBox(text,
                                      XY,
                                      Color="Black",
                                      Size=font_size,
                                      Width=bmp.Width - 30,
                                      Position="cc",
                                      Alignment="center",
                                      Weight=wx.BOLD,
                                      InForeground=True,
                                      Font=font,
                                      LineWidth=0,
                                      LineColor=None)

        FC.Group.__init__(self, [self.box, self.label], InForeground=True)