Blender Studio
  • Films
  • Projects
  • Training
  • Characters
  • Tools
  • Blog
  • Join
  • BLENDER.ORG

    • Download

      Get the latest Blender, older versions, or experimental builds.

    • What's New

      Stay up-to-date with the new features in the latest Blender releases.

    LEARNING & RESOURCES

    • Blender Studio

      Access production assets and knowledge from the open movies.

    • Manual

      Documentation on the usage and features in Blender.

    DEVELOPMENT

    • Developers Blog

      Latest development updates, by Blender developers.

    • Documentation

      Guidelines, release notes and development docs.

    • Benchmark

      A platform to collect and share results of the Blender Benchmark.

    • Blender Conference

      The yearly event that brings the community together.

    DONATE

    • Development Fund

      Support core development with a monthly contribution.

    • One-time Donations

      Perform a single donation with more payment options available.

Training Highlights
Stylized Rendering with Brushstrokes
Geometry Nodes from Scratch
Procedural Shading Fundamentals
Stylized Character Workflow

Training types
Course Documentation Production Lesson Workshop

Training categories
Animation Geometry Nodes Lighting Rendering Rigging Shading
Film Highlights
Wing It!
2023
Charge
2022
Sprite Fright
2021
Spring
2019
Project Highlights
Project DogWalk
Interactive
Gold
Showcase
BCON24 Identity
Showcase
Fighting with Grease Pencil
Article
Course
Scripting for Artists
Blender Versions
Videos
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

Sybren Stüvel
Sybren Stüvel Author
  • Free
Download English Subtitles
Download .mp4   98.0 MB
License CC-BY
Report Problem
Videos

User Interfaces

Buttons, panels, and menus. In this chapter of Scripting for Artists, Sybren shows the basics of creating your own user interface in Blender.

  • Finding existing UI code: 00:55
  • Ingredients of a Panel: 01:42
  • Different import styles: 03:00
  • Monkey Grid panel: 04:09
  • Adding operator buttons: 06:03
  • Basic layout tweaks: 09:21
  • Adding scene and object properties: 10:20
  • Conditional drawing: 13:26
  • Adding operators to menus: 15:30

Join to leave a comment.

7 comments
Refone
Refone
July 1st, 2024

Hi sybren, thanks for your tutorial! I just get confused at around 9:00, about the "Big Grid" and "Small Grid". The Sample's code is like:

props = self.layout.operator('mesh.monkey_grid',
                            text='Big Grid',
                            icon='MONKEY')
props.count_x = 10
props.count_y = 10
props.dize = 0.8

props = self.layout.operator('mesh.monkey_grid',
                            text='Small Grid',
                            icon='MONKEY')
props.count_x = 1
props.count_y = 1

But how can a single variable props work for two buttons? The fact is when I'm running this script on Blender 4.1, the Small Grid button didn't show up. So is there anything I've missed? Hope for explain.

Refone
Refone
July 1st, 2024

Sorry, I just found that I made mistake, typing props.size to props.dize. And script quit silently from that line. After correcting it, the small button showed up. But I'm still can't understand my origin question, why a single props can work for two buttons. Maybe there's no single words can explain why, still hope for explaination.

Show more replies
Rune Spaans
Rune Spaans
April 2nd, 2025

@Refone I am no expert, but I think it's because the script is reusing the variable "prop" to create the button. After the first operator is created, you can use the same variable name to create a new operator. They will not be linked together even though the share the variable used on creation. At least that's how I understand it :)

Tijm Lanjouw
Tijm Lanjouw
July 20th, 2020

Thanks for the tutorial. But how do I make the x, y and size values be defined by user input in the panel? I tried:

    def draw(self, context): #draw panel
        col = self.layout.column(align=True)
        props = col.operator('mesh.monkey_grid',
            text = 'Generate Grid',
            icon = 'MONKEY')

        col.label(text="Column Two:")
        col.prop(props, 'count_x')
        col.prop(props, 'count_y')
        col.prop(props, 'size')

The fields with the default paramaters show up in the panel, but I'm not able to change them. My guess is that I have to work with variables. I tried a couple of things, but I failed. Anyone?

Sybren Stüvel
Sybren Stüvel
Aug. 4th, 2020

*@Tijm Lanjouw* You have to define the user-editable properties somewhere else. If they are to be saved within the blend file, you typically would add them to bpy.types.Scene. If they are temporary, you typically add them to bpy.types.WindowManager. You can then use them to assign for example props.count_x = context.scene.my_monkey_grid_count_x.

You cannot use operator properties with layout.prop().

Ludwig Heijden
Ludwig Heijden
Jan. 2nd, 2021

@Sybren A. Stüvel For those searching, this is explained better in chapter 11 ;)

Samuel Bernou
Samuel Bernou
April 19th, 2020

A very clear and resourceful video. Even after making 30+ addons I learned a few things. e.g: I will certainly use columns starting now ;), thanks Doc.

Films Projects Training Blog Blender Studio for Teams
Pipeline and Tools
  • CloudRig
  • Blender Kitsu
  • Brushstroke Tools Add-on
  • Blender Studio Extensions
Characters
  • Mikassa
  • Whale
  • Ballan Wrasse
  • Snow
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
Blender Studio

The creators who share.

Artistic freedom starts with Blender The Free and Open Source 3D Creation Suite