# How to arrange multiple buttons vertically

I wrote the following code.

import bpy

bl_info = {
"author": "taichi suzuki",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "3DView",
"warning": "",
"support": "COMMUNITY",
"wiki_url": "",
"tracker_url": "",
"category": "test"
}

bl_space_type = "VIEW_3D"
bl_region_type = "UI"

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

col = layout.column()

_timer = None
number = 0

def __init__(self):
self.test = None

def modal(self, context, event):
if event.type in {'ESC'}:
self.cancel(context)
return{'CANCELLED'}

if event.type=='TIMER':
print(self.number)

return{'PASS_THROUGH'}

def execute(self, context):
wm = context.window_manager

print(self.number)

return {'RUNNING_MODAL'}

def cancel(self, context):
wm = context.window_manager
wm.event_timer_remove(self._timer)

def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)

def unregister():
from bpy.utils import unregister_class
for cls in classes:
unregister_class(cls)

if __name__ == "__main__":
register()


After installing this add-on, you will see only one button labeled'modal start1'.

But I actually want to see the 'modal start2' button as well.

Why does this code show only one button?

• Recommend you look in the system console for an error message. The number property needs to be set up as a number: bpy.props.IntProperty(...) annotation of the operator class to be used with layout.operator("foo.bar").number = 1 , hence it draws the first button and then error is thrown. Would say this is an XY Problem since the layout is not the issue. Nov 10 '20 at 8:51
• Thank you. That's the solution! Nov 10 '20 at 9:15