Update widgets.py

Remove duplicate code