Changing the value of a button

Hi

I want to change the value of a textfield in a python generated gui for a script I made by pressing another button. But the updated value won’t show. I’m quite stuck.

It’s for 2.49b.

So, what’s the correct syntax to change a button value and see it updated in the window?

Thanks in advance

Haunt

import Blender
from Blender import Draw

QUIT_BUTTON = 1
PREV_CAM = 20
NEXT_CAM = 21
ADD_CAMERA =15
NONE = 99

dd = Draw.Create('')

def event(evt, val):
	if (evt == Draw.ESCKEY and not val):
		Draw.Exit()

def bevent(evt):
	if evt == QUIT_BUTTON:
		Draw.Exit()

	if evt == ADD_CAMERA:
		print ' hallo '

	if evt == NEXT_CAM:
		print dd.val

	if evt == PREV_CAM:
		dd.val = 'nix'
		print dd.val
	Blender.Redraw()

def gui():
	global dd
	Draw.Button("<", NEXT_CAM, 250, 300, 30, 18)
	Draw.Button(">", PREV_CAM, 290,300, 30, 18)
	dd = Draw.String("Ende : ", ADD_CAMERA, 20, 70, 150, 20, "buh", 5, "grks")

Draw.Register(gui, event, bevent)

import Blender
from Blender import Draw

QUIT_BUTTON = 1
PREV_CAM = 20
NEXT_CAM = 21
ADD_CAMERA =15
NONE = 99

ddval = "buh"

def event(evt, val):
    if (evt == Draw.ESCKEY and not val):
        Draw.Exit()

def bevent(evt):
    global ddval
    if evt == QUIT_BUTTON:
        Draw.Exit()

    if evt == ADD_CAMERA:
        print ' hallo '

    if evt == NEXT_CAM:
        print ddval

    if evt == PREV_CAM:
        ddval = 'nix'
        print ddval
    Blender.Redraw()

def gui():
    Draw.Button("<", NEXT_CAM, 250, 300, 30, 18)
    Draw.Button(">", PREV_CAM, 290,300, 30, 18)
    Draw.String("Ende : ", ADD_CAMERA, 20, 70, 150, 20, ddval, 5, "grks")

Draw.Register(gui, event, bevent)

Thank you very much. I didn’t know that a Redraw() triggers the gui() function. So outsourcing the variable was indeed the solution.

Boy, this was a headache for a wannabe-vacation-coder like me.

Haunt