You are blocking the thread responsible for the operation you dispatch with your function call. The dispatcher queue (at least the GUI rendering part) is not processed until you let the thread idle again (i.e. the method/event handler whatever is exited).
Do your function execution on another thread.