使用Tix.Balloon设置默认状态栏消息

时间:2012-09-09 16:10:19

标签: python tkinter tooltip popup-balloons tix

我目前正在尝试使用Tix.Balloon为图形用户界面中的选项创建工具提示和帮助状态栏。它的工作原理非常符合预期。但是,我希望状态栏显示鼠标何时未超过绑定小部件的消息。

具体来说,当其中一个方框没有突出显示时,我希望状态栏能说出“所有角度均为度”的内容。

目前代码看起来有点像:

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()

这在开头的状态栏中有“所有角度都以度为单位”的消息,但是在标签中的一个状态消息替换它之后,它就不会返回。

有什么建议吗?

0 个答案:

没有答案