Skip to content

Commit

Permalink
Tooltips go off-screen Akuli#1224
Browse files Browse the repository at this point in the history
  • Loading branch information
lawson89 committed Oct 13, 2023
1 parent 2f70548 commit f7757fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions porcupine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,18 @@ def show(self) -> None:
if self.got_mouse:
self.destroy_tipwindow()
tipwindow = type(self).tipwindow = tkinter.Toplevel()
tipwindow.geometry(f"+{self.mousex + 10}+{self.mousey - 10}")
tipwindow.bind("<Motion>", self.destroy_tipwindow, add=True)
tipwindow.overrideredirect(True)

# If you modify this, make sure to always define either no
# colors at all or both foreground and background. Otherwise
# the label will have light text on a light background or
# dark text on a dark background on some systems.
tkinter.Label(tipwindow, text=self.text, border=3, fg="black", bg="white").pack()
label = tkinter.Label(tipwindow, text=self.text, border=3, fg="black", bg="white")
label.pack()
tipwindow.update()
tw_width = tipwindow.winfo_width()
tipwindow.geometry(f"+{self.mousex - tw_width}+{self.mousey - 30}")


def set_tooltip(widget: tkinter.Widget, text: str) -> None:
Expand Down

0 comments on commit f7757fc

Please sign in to comment.