one stutter after keypress

I made something move with my up_arrow, and i use this code to do that:

def omhoog():
	global x
	x = x + 1

base.accept('arrow_up', omhoog )
base.accept('arrow_up-repeat', omhoog )

First i only had the arrow_up-repeat, but it waited some time and then started to move. I thought the time before the repeat is for the normal arrow_up, but that one didn’t fill the whole gap, just the beginning, so now when i press and held down the up arrow, my character moves, stops, moves, and stays like that.
I’ve got this problem before in Adobe Flash, and there i fixed it, but i don’t know how to fix it here…
It seems like an easy problem, how can i fix it?

You don’t want to use a repeat function for this, and it’s exactly why you’re getting a delay; it’s the equivalent to going into a text editor and holding down a letter - you type one, then after a second it starts repeating. It can also make your movement jittery.

Check the Roaming Ralph example for the best way to go about this. You only need the

base.accept('arrow_up', omhoog ) 

to move the object, but what makes that repeat every frame is adding it to a task (again, Roaming Ralph is a perfect example of this).

Basically, you have one accept for arrow_up, and then one for arrow_up-up (meaning the key is “up” aka not pressed in). Then in your function, state that only when the key is pressed in, move the object.

Sorry if I’m not explaining this well enough, I have a very simplified version of this working I can send you when I get home from work if you are still having trouble.

Ya what he said.

If your movement is going on inside of a task, have some variable isKeyUpPressed (cant think of a better name) be a boolean for whether or not to move your avatar around.

Simple Example:

#set up your task somewhere

isKeyUpPressed = False
base.accept('arrow_up', setKeyUpPressed)

def setKeyUpPressed():
    isKeyUpPressed = True

def unsetKeyUpPressed():
    isKeyUpPressed = False

def taskFunc(task):
    if isKeyUpPressed:
        #move around avatar
return task.again

it works!
thanks to you both
I used your code except that i made a global of the booleans.