Need help with positioning GUI Object

Hi , I am new to python and programing in blender and I am not a native speaker so sometime I may tell something does not make sense or cracky gramma … he hee

I start making some blender + python project which making some about advance particle motion and I want it to easy to use with nice interface using…

I having a problem about how to make some of an gui object to always set in the center of the script area…

here is my original code



import Blender
from Blender import Image, Draw, Window
from Blender.BGL import *


def gui(): ##GetInterface
	Draw.Image(myimage1, posx1, posy1)

def event(evt, val):
	if evt == Draw.ESCKEY:
		Draw.Exit()	
    
areasize = Blender.Window.GetAreaSize()
areawidth = areasize[0]
areaheight = areasize[1]

myimage1 = Image.Load("plugins\opible\mres\interfce\logo.png")
posx1 = areawidth/2
posy1 = areaheight/2

Draw.Register(gui, event, None)


The resault is the image set in the center when the script is executed
but when I change it’s area size… it moves after left-bottom of area

The question is :

  1. How to make some of an gui object to always set in the center of the scripts area whenever I resize it?
  2. Techniq ? If I load more than 1 image and make it drawed.
  3. Can I set the size of script area with python code?

Thanks very much for suggestion… :slight_smile:

Maybe try

Window.Redraw("SCRIPT")

i would suggest to move this in the gui() function:


areasize = Blender.Window.GetAreaSize()
areawidth = areasize[0]
areaheight = areasize[1]

posx1 = areawidth/2
posy1 = areaheight/2