eric6/Snapshot/SnapshotTimer.py

changeset 7366
bd743eacfbca
parent 7360
9190402e4505
child 7781
607a6098cb44
diff -r da7e4df94076 -r bd743eacfbca eric6/Snapshot/SnapshotTimer.py
--- a/eric6/Snapshot/SnapshotTimer.py	Wed Jan 08 18:57:10 2020 +0100
+++ b/eric6/Snapshot/SnapshotTimer.py	Wed Jan 08 18:58:31 2020 +0100
@@ -39,10 +39,13 @@
         self.__toggle = True
         
         # text is taken from paintEvent with maximum number plus some margin
-        self.resize(
-            self.fontMetrics().width(self.tr(
-                "Snapshot will be taken in %n seconds", "", 99)) + 6,
-            self.fontMetrics().height() + 4)
+        try:
+            fmWidth = self.fontMetrics().horizontalAdvance(self.tr(
+                "Snapshot will be taken in %n seconds", "", 99))
+        except AttributeError:
+            fmWidth = self.fontMetrics().width(self.tr(
+                "Snapshot will be taken in %n seconds", "", 99))
+        self.resize(fmWidth + 6, self.fontMetrics().height() + 4)
         
         self.__timer.timeout.connect(self.__bell)
     

eric ide

mercurial