【发布时间】:2017-09-22 20:55:35
【问题描述】:
这很难解释。在我的程序中有两个 Checkbutton(这可能是他们的名字,但我说的是可以标记的正方形)。我希望当鼠标放在它们上面时出现一个小标题。如果我可以在消息出现之前设置一个时间会更好。 谢谢!
from tkinter import*
from tkinter import messagebox
root = Tk()
root.configure(bg='lightblue')
root.title("#1")
root.geometry("180x60+350+220")
request = StringVar() #i did the same with all other variables
inte=["explorer" , "Explorer","rete"]
chro=["chrome" ,"Chrome","ricerca",]
of=["openoffice","foglio bianco","scrittura"]
dia = Entry(root, textvariable = request, bg="white").grid(row=0,column=1)
chk = Checkbutton(root,text="Ricerca in internet", textvariable = fla,
bg="lightblue").grid(row=0,column=0) #first checkbutton
chk1 = Checkbutton(root,text="Ricerca in internet", textvariable = ran,
bg="lightblue").grid(row=0,column=2) #the second one
def apri():
if request.get().strip() in inte:
subprocess.Popen(['C:\Program Files\Internet Explorer\\iexplore.exe']) #i did the same with all other lists
else:
webbrowser.open("https://www.google.it/search?q={0}&oq={0}&aqs=chrome..69i57j0j69i61j0l3.1306j0j7&sourceid=chrome&ie=UTF-8".format(request.get().strip()))
bott = Button(root, text="Cerca", command = apri,
bg="white").grid(row=1,column=1)
这是我的程序,我从任何步骤中都举了一个例子
【问题讨论】:
-
您在谈论工具提示,许多库都实现了它们,您在项目中使用的是哪一个?用一些代码来解释也不太难......
-
我正在使用 tkinter,我会尽快编辑我的帖子
-
我认为它在标准 tkinter 中不可用,但您可以找到许多自定义类的示例来处理它。尝试使用“tooltip and tkinter”进行一些查询
-
完美,谢谢。