Skip to main content
replaced http://blender.stackexchange.com/ with https://blender.stackexchange.com/
Source Link

I got it batFINGERbatFINGER

Thanks! Mine was verbose indeed, but alas not close.

import bpy
from bpy.props import *

def initSceneProperties(scn):
    bpy.types.Scene.MyBool = BoolProperty(
        name = "Boolean", 
        description = "None")
    scn['MyBool'] = True
    return
 
initSceneProperties(bpy.context.scene)

class UIPanel(bpy.types.Panel):
    bl_label = "Property panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
 
    def draw(self, context):
        layout = self.layout
        scn = context.scene
        
        if scn.MyBool:
            icon = 'X_VEC'
            txt = 'Cancel'
        else:
            icon = "PAUSE"
            txt = 'Pause'
        
        layout.prop(scn, 'MyBool', text=txt, icon=icon, toggle = True)
        layout.label(text= txt)

bpy.utils.register_module(__name__)

I got it batFINGER

Thanks! Mine was verbose indeed, but alas not close.

import bpy
from bpy.props import *

def initSceneProperties(scn):
    bpy.types.Scene.MyBool = BoolProperty(
        name = "Boolean", 
        description = "None")
    scn['MyBool'] = True
    return
 
initSceneProperties(bpy.context.scene)

class UIPanel(bpy.types.Panel):
    bl_label = "Property panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
 
    def draw(self, context):
        layout = self.layout
        scn = context.scene
        
        if scn.MyBool:
            icon = 'X_VEC'
            txt = 'Cancel'
        else:
            icon = "PAUSE"
            txt = 'Pause'
        
        layout.prop(scn, 'MyBool', text=txt, icon=icon, toggle = True)
        layout.label(text= txt)

bpy.utils.register_module(__name__)

I got it batFINGER

Thanks! Mine was verbose indeed, but alas not close.

import bpy
from bpy.props import *

def initSceneProperties(scn):
    bpy.types.Scene.MyBool = BoolProperty(
        name = "Boolean", 
        description = "None")
    scn['MyBool'] = True
    return
 
initSceneProperties(bpy.context.scene)

class UIPanel(bpy.types.Panel):
    bl_label = "Property panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
 
    def draw(self, context):
        layout = self.layout
        scn = context.scene
        
        if scn.MyBool:
            icon = 'X_VEC'
            txt = 'Cancel'
        else:
            icon = "PAUSE"
            txt = 'Pause'
        
        layout.prop(scn, 'MyBool', text=txt, icon=icon, toggle = True)
        layout.label(text= txt)

bpy.utils.register_module(__name__)
Source Link
ACopeLan
  • 390
  • 4
  • 15

I got it batFINGER

Thanks! Mine was verbose indeed, but alas not close.

import bpy
from bpy.props import *

def initSceneProperties(scn):
    bpy.types.Scene.MyBool = BoolProperty(
        name = "Boolean", 
        description = "None")
    scn['MyBool'] = True
    return
 
initSceneProperties(bpy.context.scene)

class UIPanel(bpy.types.Panel):
    bl_label = "Property panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
 
    def draw(self, context):
        layout = self.layout
        scn = context.scene
        
        if scn.MyBool:
            icon = 'X_VEC'
            txt = 'Cancel'
        else:
            icon = "PAUSE"
            txt = 'Pause'
        
        layout.prop(scn, 'MyBool', text=txt, icon=icon, toggle = True)
        layout.label(text= txt)

bpy.utils.register_module(__name__)