diff --git a/spyder/widgets/status.py b/spyder/widgets/status.py
index <HASH>..<HASH> 100644
--- a/spyder/widgets/status.py
+++ b/spyder/widgets/status.py
@@ -44,6 +44,14 @@ class StatusBarWidget(QWidget):
         self.label_icon = QLabel()
         self.label_value = QLabel()
 
+        # Layout setup
+        layout = QHBoxLayout(self)
+        layout.setSpacing(0)  # Reduce space between icon and label
+        layout.addWidget(self.label_icon)
+        layout.addWidget(self.label_value)
+        layout.addSpacing(20)
+        layout.setContentsMargins(0, 0, 0, 0)
+
         # Widget setup
         self.set_icon(icon)
 
@@ -52,20 +60,6 @@ class StatusBarWidget(QWidget):
         self.label_value.setAlignment(Qt.AlignRight)
         self.label_value.setFont(self.text_font)
 
-        # Layout
-        layout = QHBoxLayout()
-        layout.setSpacing(0)  # Reduce space between icon and label
-        layout.addWidget(self.label_icon)
-        self.label_icon.setVisible(icon is not None)
-
-
-        layout.addWidget(self.label_value)
-        layout.addSpacing(20)
-
-        # Layout setup
-        layout.setContentsMargins(0, 0, 0, 0)
-        self.setLayout(layout)
-
         # Setup
         statusbar.addPermanentWidget(self)
         self.set_value('')
Setup layout before call to widget setVisible