# Python Panel Dropdownlist and Integer Button [duplicate]

I am trying to create a dropdownlist and a increment/decrement button in my custom UI Panel. I can't seem to find how to do this. Does anyone know how?

Here are visual Examples

Thank you in advance for your help and have a nice day! :)

Here the code for this example:

bl_info = {
"author": "Me myself and I",
"version": (0, 0, 1),
"blender": (2, 80, 0),
"location": "View3D > UI > MY TEST",
"description": "This is a test UI addon",
"warning": "",
"doc_url": "",
"category": "3D View",
}

import bpy
from bpy.types import Panel, PropertyGroup, Scene, WindowManager
from bpy.props import (
IntProperty,
EnumProperty,
StringProperty,
PointerProperty,
)

class MYTEST_PT_Panel(Panel):
bl_idname = "MYTEST_PT_Panel"
bl_label = "MY UI"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "MY TEST"
bl_options = {'DEFAULT_CLOSED'}

def draw(self, context):
layout = self.layout
placeholder = context.scene.placeholder
col = layout.column()
col.prop(placeholder, "inc_dec_int", text="Increment/Decrease")
col.prop(placeholder, "dropdown_box", text="Dropdown")
col.prop(placeholder, "file_path", text="Filepath")

class PlaceholderProperties(PropertyGroup):
inc_dec_int: IntProperty(
name="Incr-Decr", min=1, default=4, description="Tooltip for Incr-Decr"
)
dropdown_box: EnumProperty(
items=(
("A", "Ahh", "Tooltip for A"),
("B", "Be", "Tooltip for B"),
("C", "Ce", "Tooltip for C"),
),
name="Description for the Elements",
default="A",
description="Tooltip for the Dropdownbox",
)
file_path: StringProperty(
name="File",
default="",
description="Wanted File",
maxlen=1024,
subtype="FILE_PATH",
)

classes = (
PlaceholderProperties,
MYTEST_PT_Panel,
)

def register():
#the usual registration...
from bpy.utils import register_class

for cls in classes:
register_class(cls)

Scene.placeholder = PointerProperty(type=PlaceholderProperties)

def unregister():
#the usual unregistration in reverse order ...

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

del Scene.placeholder

if __name__ == "__main__":
register()


I believe this small example should be easy enough to follow through, i tried to use simple names to see what is used where.

The specific 3 Properties needed are the IntProperty, EnumProperty and StringProperty.

• Ohh thank you very much for this for this! :) Mar 19, 2020 at 21:02
• Do you also know how to make a filepath in the UI Panel also? I am think of StringPropertybut I am not sure if I am in the right path for this. Mar 20, 2020 at 1:18
• Updated the answer, should this solve your question, please consider to accept the answer. For further questions i would also suggest to ask a new question, as this system is not meant to have more then one question asked at once, so the answers can be as focused as possible. Good luck on your coding quest ;) Mar 20, 2020 at 1:47
• Thank you very much. Sorry about the second question, this is my first time posting on this site and I did not know that rule. thanks again :) Mar 20, 2020 at 3:27