 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Display message when hovering over something with mouse cursor in Tkinter Python
Let us suppose we want to create an application where we want to add some description on tkinter widgets such that it displays tooltip text while hovering on the button widget. It can be achieved by adding a tooltip or popup.
Tooltips are useful in applications where User Interaction is required. We can define the tooltip by instantiating the constructor of Balloon(win). After that, we can bind the button with the tooltip message that applies on the widget.
Example
#Import the tkinter library from tkinter import * from tkinter.tix import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("400x200") #Create a tooltip tip= Balloon(win) #Create a Button widget my_button=Button(win, text= "Python", font=('Helvetica bold', 20)) my_button.pack(pady=20) #Bind the tooltip with button tip.bind_widget(my_button,balloonmsg="Python is an interpreted, high-level and general-purpose programming language") win.mainloop()  Output
Running the above code will display a window with a button. Now, hover on the Button “Python” and it will display a tooltip text.

Advertisements
 