Skip to content

Example #3 Display a text with customBackground

CH4MPi edited this page Nov 13, 2022 · 5 revisions
# import the guiflash module
from gambiter import g_guiFlash
from gambiter.flash import COMPONENT_TYPE

# alpha: the transparency value for the whole textfield with background - default 1.0
# border: draws a border around the textfield - default: True
# borderColor: the border color if border is True - default: 0x000000
# color: the fill color if fill is True - default: 0x000000
# margin: the margin in pixel around the textfield before the border starts - default: 0
# ellipseWidth:
#    controls the edges of the border.
#    0 = normal rectangle
#    greater as 0 = The width of the ellipse used to draw the rounded corners (in pixels)
# fill: fills the border with the defined color. - default: True
# thickness: An integer that indicates the thickness of the line in points; valid values are 0-255.
#            If a number is not specified, or if the parameter is undefined, a line is not drawn. 
#            If a value of less than 0 is passed, the default is 0. The value 0 indicates hairline thickness;
#            the maximum thickness is 255. If a value greater than 255 is passed, the default is 255.

# create a label component (and add a customBackground)
g_guiFlash.createComponent('labelAlias', COMPONENT_TYPE.LABEL, { 'text': 'Hello, world!',
                                                                 'customBackground': {'border': True,
                                                                                      'borderColor': 0x008800,
                                                                                      'alpha': 0.66,
                                                                                      'margin': 3,
                                                                                      'ellipseWidth': 15,
                                                                                      'fill': True,
                                                                                      'thickness': 3
                                                                                      }
                                                                })

Clone this wiki locally