Improved width and height attributes

If only one was given then re-loading make the element square. Also
avoid applying the attributes before the widget becomes visible.