Pop Up Blocks for Scripts

Hello all. I have created a python script to draw a GUI inside the Scripts window, very basic. I am now wanting to enable this script to be a pop up block that the user can move around within Blender and it not be limited to just the Scripts window when it is ran. I am having trouble getting this to work. Below is some of the code that I have used for the GUI inside the Scripts window. If could, please help me with this.

import Blender, math
from Blender import BGL, Draw, Library, Scene, Window, Ipo

line = [None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None]
line[0] = 5
line[1] = 35
line[2] = 65
line[3] = 95
line[4] = 125
line[5] = 155
line[6] = 185
line[7] = 215
line[8] = 245
line[9] = 275
line[10] = 305
line[11] = 335
line[12] = 365
line[13] = 395
line[14] = 425
line[15] = 455
line[16] = 485
line[17] = 515
line[18] = 545

def draw_gui():
       global evtMenu, evtButton, evtExit, evtCase1, evtCase2, evtCase3, evtClear
       global ScriptsButton, Exit, Clear
       Draw.Text("Push When Ready to Execute Data Export:")
       ScriptButton = Draw.PushButton("Execute Data Export",evtButton, 10, line[11], 160, 18, "Exports Data to TRICK")
       IpoButton = Draw.PushButton("Set IPO Data", evtIPO, 10, line[7], 125, 18, "Sets Geometry Data to IPO Curves")
       BGL.glRasterPos2i(165, line[7])
       Draw.Text("Set IPO Curve Data for Playback")
       PlaybackButton = Draw.PushButton("Playback",evtPlayback, 10, line[5], 125, 18, "Plays Back Data in 3D View")
       BGL.glRasterPos2i(165, line[5])
       Draw.Text("View Playback in 3D View")
       AnimateButton = Draw.PushButton("Animate",evtAnimate, 10, line[3], 125, 18, "Animates Frames for Viewing")
       BGL.glRasterPos2i(165, line[3])
       Draw.Text("Animate Frames to AVI Format For Viewing")
       Exit = Draw.PushButton("Exit",evtExit, 10, line[0], 160, 18, "Exit GUI")


I have left the event and button functions out to save time. Also, I understand that there is a PupBlock() option under the Draw module but I have had no luck as of yet with that. Thank you again in advance for the help.

In short, you can’t. Floating panels (like the properties panel, in the 3D view) cannot cross subwindow boundaries, they are locked to their respective subwindows.

PupBlock is used to make a custom popup dialog, not to make a “special window”. For a good example of PupBlock, look at the end of uv_export.py, the “Save UV Face Layout” script included with Blender


If you want to make a special window, see Draw.UIBlock() - export_fbx.py uses this. It has one big limitation - no menu’s, this is a blender limitation and Iv tried to resolve, but its not easy.