# keeping a UIlayout box a specific width percentage

**URL:** <https://blenderartists.org/t/keeping-a-uilayout-box-a-specific-width-percentage/531111>\
**Category:** Python Support\
**Created:** [January 29, 2012, 6:52am UTC](https://blenderartists.org/t/keeping-a-uilayout-box-a-specific-width-percentage/531111 "2012-01-29T06:52:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BnTheMan](https://blenderartists.org/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@BnTheMan](https://blenderartists.org/u/BnTheMan)\
**Post date:** [January 29, 2012, 6:52am UTC](https://blenderartists.org/t/keeping-a-uilayout-box-a-specific-width-percentage/531111/1 "2012-01-29T06:52:25Z")

</div>

So I have searched hi and low for this on Google and here at BlenderArtist with no success. My plan is to have 2 columns in one row. The first column holding a box layout, and in the second column, I want an operator button. I would also like for the box layout take up 80 percent of the total width. Does anyone here know how to do this? I tried playing with the scale\_x attribute but that did not seem to change anything.

---

<div class="post-metadata">

**Author:** ![dustractor](https://blenderartists.org/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dustractor](https://blenderartists.org/u/dustractor)\
**Post date:** [January 29, 2012, 12:13pm UTC](https://blenderartists.org/t/keeping-a-uilayout-box-a-specific-width-percentage/531111/2 "2012-01-29T12:13:49Z")

</div>

try this:

```auto

import bpy

def drawtest(self,context):
    split = self.layout.split(percentage=0.8)
    col1,col2 = (split.column(),split.column())
    col1.label('col1')
    col1.label('col1')
    col1.label('col1')
    col1.label('col1')
    col2.operator('object.editmode_toggle')
bpy.types.VIEW3D_PT_tools_objectmode.append(drawtest)

```

---

<div class="post-metadata">

**Author:** ![batFINGER](https://blenderartists.org/user_avatar/blenderartists.org/batfinger/32/5981_2.png) [@batFINGER](https://blenderartists.org/u/batFINGER)\
**Post date:** [January 29, 2012, 8:45pm UTC](https://blenderartists.org/t/keeping-a-uilayout-box-a-specific-width-percentage/531111/3 "2012-01-29T20:45:27Z")

</div>

Mocked this up last night forgot to post… pretty similar to dusties.

```auto

import bpy

class HelloWorldPanel(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        obj = context.object
        row = layout.row()
        split = row.split(percentage=0.8,align=True)
        box = split.box()
        box.label(text="80")
        split.operator("wm.console_toggle")
        
        
        row = layout.row()
        row.label(text="Hello world!", icon='WORLD_DATA')

        row = layout.row()
        row.label(text="Active object is: " + obj.name)
        row = layout.row()
        row.prop(obj, "name")

def register():
    bpy.utils.register_class(HelloWorldPanel)

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)

if __name__ == " __main__":
    register()

```

---

<div class="post-metadata">

**Author:** ![BnTheMan](https://blenderartists.org/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@BnTheMan](https://blenderartists.org/u/BnTheMan)\
**Post date:** [February 1, 2012, 4:24am UTC](https://blenderartists.org/t/keeping-a-uilayout-box-a-specific-width-percentage/531111/4 "2012-02-01T04:24:47Z")

</div>

thank you both. Also I found template\_list, which better suits my needs. This works out since I am trying to create a folder collection. The folder collection will then allow my other script to search the given folders the user specifies.
