-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtooltip.py
More file actions
21 lines (19 loc) · 782 Bytes
/
Copy pathtooltip.py
File metadata and controls
21 lines (19 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
################################################################################
# tooltip
################################################################################
import tkinter as tk
class TooltipHandler:
def __init__(self, root):
self.root = root
self.active_tooltip = False
def show_tooltip(self, event, message):
if self.active_tooltip:
return
self.active_tooltip = True
tooltip = tk.Toplevel()
tooltip.wm_overrideredirect(True)
tooltip.geometry(f"+{event.x_root + 10}+{event.y_root + 10}")
label = tk.Label(tooltip, text=message, background="yellow", relief="solid", borderwidth=1)
label.pack()
label.after(800, tooltip.destroy)
self.active_tooltip = False