0

I've designed a GUI with a login in screen. When the user's mouse hovers over the text box or the logo in the corner, I want a small message to appear next to the mouse to inform the user of what it is or what it is for.

I asked a friend, but he only knows how to do it in HTML, whilst I'm working with python. Is this type of effect possible and if so, what code do I need to include?

Here is an example of the effect I mean.

I've included some code if anyone wishes to edit it.

from tkinter import *

temp = Tk()
temp.geometry('500x300')
temp.title("Login Screen")

logo = PhotoImage(file='image.png')
logoplace = Label(temp, image=logo, bg='black')
logoplace.pack()

Entrybox = Entry(temp, width=20)
Entrybox.pack()

temp.mainloop()
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • Does this answer your question? [How do I display tooltips in Tkinter?](https://stackoverflow.com/questions/3221956/how-do-i-display-tooltips-in-tkinter). It's called a tooltip – Nullman Feb 03 '21 at 12:28

1 Answers1

0
import tkinter as tk
import webbrowser

from idlelib.tooltip import Hovertip
root = tk.Tk()
root.title('Hover')
canvas = tk.Canvas(root, bg='gray')
canvas.pack()
def Hover():
 url = 'https://stackoverflow.com'
 webbrowser.open_new(url)
myBtn = tk.Button(canvas,command=Hover,text='My Button',bg='black', fg='white')
myBtn.pack(padx=(100))
myBtn.pack(pady=(100))
myTip = Hovertip(myBtn,'Hello World!')
root.mainloop()

Example

April H.
  • 1
  • 3