Show us your script. The script I posted should do it, but you need to also create the widget and add it to the viewport.