error

I have this script:

print "-------------------"
import Blender
from Blender import Noise
import math
from math import ceil
from Blender.BGL import *
from Blender.Draw import *

Minr = Create(0.0)
Maxr = Create(1.0)
LocXr = Create(0)
LocYr = Create(0)
LocZr = Create(0)
SizeXr = Create(0)
SizeYr = Create(0)
SizeZr = Create(0)
SameLr = Create(0)
SameRr = Create(0)
SameSr = Create(0)

EVENT_NOEVENT = 1
EVENT_RANDOM  = 2
EVENT_EXIT    = 3

def draw():
    global Minr, Maxr
    global LocXr, LocYr, LocZr
    global SizeXr, SizeYr, SizeZr
    global SameLr, SameRr, SameSr
    global EVENT_NOEVENT, EVENT_RANDOM, EVENT_EXIT

    glClear(GL_COLOR_BUFFER_BIT)
    glRasterPos2d(10, 170)
    Text("Randomizer script")
    glRasterPos2d(10, 80)
    Text("Location:")
    glRasterPos2d(10, 50)
    Text("Size:")
    Minr = Number("Minimal", EVENT_NOEVENT, 10, 140, 120, 20,
                    Minr.val, -1000, 1000, "The minimal random number");
    Maxr = Number("Maximal", EVENT_NOEVENT, 10, 110, 120, 20,
                    Maxr.val, -1000, 1000, "The maximal random number");
    LocXr = Toggle("X", 10, 70, 80, 20, 20, LocXr.val, "Randomizes X location");
    LocYr = Toggle("Y", 10, 90, 80, 20, 20, LocYr.val, "Randomizes Y location");
    LocZr = Toggle("Z", 10, 110, 80, 20, 20, LocZr.val, "Randomizes Z location");
    SizeXr = Toggle("X", 10, 70, 50, 20, 20, SizeXr.val, "Randomizes X size");
    SizeYr = Toggle("Y", 10, 90, 50, 20, 20, SizeYr.val, "Randomizes Y size");
    SizeZr = Toggle("Z", 10, 110, 50, 20, 20, SizeZr.val, "Randomizes Z size");
    SameLr = Toggle("Same", 10, 140, 80, 40, 20, SameLr.val, "Use same number for all directions");
    SameSr = Toggle("Same", 10, 140, 50, 40, 20, SameSr.val, "Use same number for all directions");
    Button("Randomize", EVENT_RANDOM, 10, 10, 80, 18)
    Button("Exit", EVENT_EXIT, 140, 10, 80, 18)

def event(evt, val):	
	if (evt == QKEY and not val): 
		Exit()

def bevent(evt):
    global Minr, Maxr
    global LocXr, LocYr, LocZr
    global SizeXr, SizeYr, SizeZr
    global SameLr, SameRr, SameSr 
    global EVENT_NOEVENT, EVENT_RANDOM, EVENT_EXIT

    if (evt == EVENT_EXIT): 
	Exit()
    elif (evt == EVENT_RANDOM):
		Randomize(Minr, Maxr, LocXr, LocYr, LocZr, SizeXr, SizeYr, SizeZr, SameLr, SameSr)
		Blender.Redraw()
Register(draw, event, bevent)

def Randomize(fMinr, fMaxr, fLocXr, fLocYr, fLocZr, fSizeXr, fSizeYr, fSizeZr, fSameLr, fSameSr):
	selobj = Blender.Object.GetSelected()
	for obj in selobj:
		if (fLocXr.val == 1):
			newxloc = (Getnumr(fMinr, fMaxr))
		else:
			newxloc = obj.getLocation()[0]
		if (fLocYr.val == 1):
			newyloc = (Getnumr(fMinr, fMaxr))
		else:
			newyloc.val = obj.getLocation()[1]
		if (fLocZr == 1):
			newzloc = (Getnumr(fMinr, fMaxr))
		else:
			newzloc = obj.getLocation()[2]
		if (fSizeXr.val == 1):
			newxsize = (Getnumr(fMinr, fMaxr))
		else:
			newxsize = obj.getSize()[0]
		if (fSizeYr.val == 1):
			newysize = (Getnumr(fMinr, fMaxr))
		else:
			newysize = obj.getSize()[1]
		if (fSizeZr.val == 1):
			newzsize = (Getnumr(fMinr, fMaxr))
		else:
			newzsize = obj.getSize()[2]
		if (fSameLr == 1):
			newyloc = newxloc
			newzloc = newxloc
		if (fSameSr == 1):
			newysize = newxsize
			newzsize = newxsize
		obj.setLocation(newxloc, newyloc, newzloc)
		obj.setSize(newxsize, newysize, newzsize)
	Blender.Redraw()
def Getnumr(min, max):	
	numr = Noise.random()
	numr = numr * ((max - min) * 1000)
	numr = math.ceil(numr)
	numr = numr + (minr * 1000)
	numr = numr / 1000
	return numr

this returns the error:

numr = numr * ((max - min) * 1000)
TypeError: unsuported operant type(s) for -: 'Button' and 'Button'

Anyone an awnser?

You are trying to do subtraction with Buttons instead of numbers.

oh i think i got it. I have to add.val to min and max