[SOLVED] Button Gap in Panel Addon

Hi,
I am making an add-on, I have 4 light buttons that I want to remove the center gap going both ways so that all buttons are aligned, butting against each other

Here is image and code…

col = split.column()
col.scale_y = rowH
col.operator('viewed3d.add_pointlight', text="Point", icon="LIGHT_POINT")
col.operator('viewed3d.add_sunlight', text="Sun", icon="LIGHT_SUN")
col = split.column()
col.scale_y = rowH
col.operator('viewed3d.add_spotlight', text="Spot", icon="LIGHT_SPOT")
col.operator('viewed3d.add_arealight', text="Area", icon="LIGHT_AREA")

addon1

change this: col = split.column()

to this: col = split.column(align=True)

for future reference: https://docs.blender.org/api/current/bpy.types.UILayout.html?highlight=column#bpy.types.UILayout.column

Nope… messed it up even worse
I already know about the article. I am a newbie and all that tells me is what the class/method is, but not how to use it. They really should put code examples on the docs… useless to newbies.

def draw(self, context):
        layout = self.layout    
        self.layout.label(text="Meshes")
        rowH = 1.2

        split = layout.split()
        col = split.column(align=True)
        col.scale_y = rowH
        col.operator('viewed3d.add_cube', text="Cube w/Bevel", icon="CUBE")
        col.operator('viewed3d.hq_sphere', text="Hi-Res Sphere (64x64)", icon="SPHERE")
        col.operator('viewed3d.add_suzanne', text="Suzanne w/SubSurf", icon="MESH_MONKEY")

        self.layout.label(text="Lights")

        split.column(align=True)
        rowH = 1.2
        col.scale_y = rowH
        col.operator('viewed3d.add_pointlight', text="Point", icon="LIGHT_POINT")
        col.operator('viewed3d.add_sunlight', text="Sun", icon="LIGHT_SUN")

        split.column(align=True)
        rowH = 1.2
        col.scale_y = rowH
        col.operator('viewed3d.add_spotlight', text="Spot", icon="LIGHT_SPOT")
        col.operator('viewed3d.add_arealight', text="Area", icon="LIGHT_AREA")

addon2

I’m not sure what your desired result is supposed to be, you’re using column so what you’re showing me looks correct. If you’re trying to group into rows use row instead.

Like I said earlier… trying to remove all gaps in between all 4 buttons.

Looking for this kind of look (minus Grease pencil text)…

addon3

right. use rows, and set align to True

col = layout.column(align=True)
row = col.row(align=True)
row.op()
row.op

row2 = col.row(align=True)
row2.op()
row2.op()

1 Like

That worked!!!
THANK YOU SO MUCH!!!

Code that works…

    col = layout.column(align=True)
    row = col.row(align=True)
    row.operator('viewed3d.add_pointlight', text="Point", icon="LIGHT_POINT")
    row.operator('viewed3d.add_sunlight', text="Sun", icon="LIGHT_SUN")
    row2 = col.row(align=True)
    row2.operator('viewed3d.add_spotlight', text="Spot", icon="LIGHT_SPOT")
    row2.operator('viewed3d.add_arealight', text="Area", icon="LIGHT_AREA")

addon4