[Skencil-users] Small tooltips impovement

Igor Novikov igor.e.novikov at gmail.com
Thu Aug 24 14:11:31 CEST 2006


Hi all,

We have small patch to improve Skencil tooltips look-and-feel and behavior:
======================================
--- tooltips_old.py    2006-08-24 13:25:17.000000000 +0300
+++ tooltips.py    2006-08-24 14:22:00.000000000 +0300
@@ -58,10 +58,10 @@

     def create_balloon(self, root):
     self.root = root
-    self.balloon = Toplevel(self.root, name = 'tooltips')
+    self.balloon = Toplevel(self.root, name = 'tooltips', bg='black',
borderwidth=1)
     self.balloon.withdraw()
     self.balloon.overrideredirect(1)
-    label = Label(self.balloon, name = 'label', text = 'Tooltip')
+    label = Label(self.balloon, name = 'label', text = 'Tooltip', bg =
'#FFFFDC', relief = 'flat')
     label.pack()
     self.balloon_label = label

@@ -70,7 +70,22 @@
     self.last_widget = widget_name
     self.balloon.withdraw()
     self.balloon_label['text'] = text
-    x = x - self.balloon_label.winfo_reqwidth() / 2
+
+    width=self.balloon_label.winfo_reqwidth()
+    height=self.balloon_label.winfo_reqheight()
+
+    screenwidth=self.root.winfo_screenwidth()
+    screenheight=self.root.winfo_screenheight()
+
+    x=self.root.winfo_pointerx()
+    y=self.root.winfo_pointery()+20
+
+    if screenwidth<(x+width):
+        x=x-width
+
+    if screenheight<(y+height):
+        y=y-height-25
+
     self.balloon.geometry('%+d%+d' % (x, y))
     self.balloon.update()
     self.balloon.deiconify()

======================================
After patching Skencil tooltips will be similar to KDE or Gnome tooltips.
Patch should be applied to <skencil_dir>/Sketch/UI/tooltips.py file.

Sincerely,

Igor Novikov
sK1 Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wald.intevation.org/pipermail/skencil-users/attachments/20060824/22174475/attachment.htm


More information about the Skencil-users mailing list