The image above is what I was hoping to put in a PupBlock menu. As far as I can tell, it’s not possible. Can someone let me know for sure whether or not I can append a ColorPicker button inside of a PupBlock popup menu?
Blender 2.49 script code:
pipesInput = Blender.Draw.Create(pipesInputStart) pipeColor = Blender.Draw.ColorPicker(8, 0, 0, 200, 200, (0.6,0.2,0.4), "Inner Pipe Color",gui_handleEvent) block =  block.append(("Pipes: ", pipesInput, 1, 200, "Number of pipes per row")) block.append(("Pipe Color", pipeColor, 0.0, 1.0, "Inner piper color")) if not Blender.Draw.PupBlock("Create MultiPipes",block): return print "color: ", pipeColor.val
The result of the above code is that a blank button is created below the Pipes numeric slider button. The blank button does nothing if clicked. If I press OK. The original tuple color value is printed in the console. If I try to put tuple values in the max, min (now 0.0, 1.0) areas, I always get an error.
So, is ColorPicker an incompatible Button Object type to place in a PupBlock?
Now, I’m trying a second approach:
before the PupBlock I have:
Draw.Register(gui, None, gui_handleEvent)
def gui_handleEvent( evt, val ): print "gui_handleEvent :: ", evt, " > ", val if not val: # val = 0: it's a key/mbutton release if evt in [Draw.LEFTMOUSE, Draw.MIDDLEMOUSE, Draw.RIGHTMOUSE]: print "You released a mouse button." Draw.Redraw(1) return if evt == Draw.ESCKEY: Draw.Exit() # exit when user presses ESC return Draw.Redraw(1) def gui(): global b b= Blender.Draw.ColorPicker(9, 100, 100, 200, 200, (0.6,0.2,0.4), "Inner Pipe Color",gui_handleEvent)
The result of this is that after clicking OK on the PupBlock, a ColorPicker square is drawn in Blender’s main Buttons Window. When I chose a color, I’m currently getting an error: gui_handleEvent() takes exactly 2 arguments (1 given).
Anyway, this second method doesn’t help much because it displays the ColorPicker after the user has already clicked OK on the PupBlock popup window. I need the ColorPicker displayed on top or beside the PupBlock menu, while it is still active before the user presses OK.
From what my searches have turned up, it seems I will have to discard the PupBlock gui and draw a new gui from scratch if I want to use a Draw.ColorPicker button object. Is that correct?