2

I am currently trying to use a Tix.Balloon to create a tooltip and a help statusbar for options within a graphical user interface. And it works pretty much as intended. However I would like the statusbar to show a message for when the mouse is not over a bound widget.

Specifically I would like the status bar to say something like "All angles are in degrees" when one of the boxes are not highlighted.

Currently the code looks a little like:

from Tkinter import *
from Tix import *
root = Tk()
status = Label(root, height = 3, width=30, bd=1,bg='yellow',wraplength = 210, text = "All angles are in degrees")
status.grid(row = 0,column = 0,pady = 10)
bal = Balloon(root,statusbar = status)
frame_1 = Frame(root,relief=RIDGE,bd = 2)
frame_1.grid(row=1,column = 0)
Angles = [StringVar(),StringVar()]

#Incomming
label_in = Label(frame_1,text = "TH_in")
label_in.grid(row = 0,column = 0)

entry_in = Entry(frame_1, width = 20, textvariable = Angles[0])
entry_in.grid(row = 0,column = 1)

#Outgoing
label_out = Label(frame_1,text = "TH_out")
label_out.grid(row = 1,column = 0)

entry_out = Entry(frame_1, width = 20, textvariable = Angles[1])
entry_out.grid(row=1,column=1)

#tool tip / status bar
bal.bind_widget(label_in,balloonmsg='Incidence Angle',statusmsg = 'Incidence angle of the incoming light with respect to the surface normal.')
bal.bind_widget(label_out,balloonmsg='Detector Angle',statusmsg = 'Angle between the surface normal and the detector')
root.mainloop()

This has the "all angles are in degrees" message in the status bar at the start, but after one of the status messages from the labels replaces it, it does not come back.

Any suggestions?

David Duncan
  • 81
  • 1
  • 11
  • Do you think you could create a global variable and then bind each widgets `Enter` and `Leave` events to a function that sets the variable to True and False respectively? Then you would be able to check if the mouse was hovering over a widget, and if not, have it set the status to whatever your default is. – noahbkim Apr 21 '14 at 22:34

0 Answers0