【问题标题】:How to use Balloon or Tooltip with a image ? Tkinter Tix or another Tooltip如何使用带有图像的气球或工具提示? Tkinter Tix 或其他工具提示
【发布时间】:2021-03-11 01:09:53
【问题描述】:

您好,我想在工具提示中设置一张图片 这可能吗?

from tkinter import*
from tkinter.tix import*
from utils import get_path


root =Tk()
root.title('hola')
root.geometry("500x500")

tip = Balloon(root)
tip.config(bg='grey')

tip.label.config(bg='red',fg='white',bd=2)

path_img=get_path('images')

image_tip= PhotoImage(file = path_img+'blueTP.png')
mylabel= Label(root,text='MOS',image=image_tip)
mylabel.pack(pady=50)



tip.bind_widget(mylabel,balloonmsg='MOS stands for "Mean Opinion Score" \n and it calculates the quality of internet service to provide the best audio quality to our customers. \n\n Formula; 1 * 0.035* R + 0.000007* R *(R-60) * (100-R)')

root.mainloop()

但是我想把图片显示在气球里面,可以吗?

我有这个:

但我需要这样的东西:

【问题讨论】:

    标签: image tkinter tooltip balloon


    【解决方案1】:

    Result

    from tkinter import*
    from tkinter.tix import*
    from utils import get_setting,get_agentSettings,get_botSettings,get_path,whoami,myOs,get_netLogin
        
        
    root =Tk()
    root.title('hola')
    root.geometry("500x500")
    
    tip = Balloon(root)
    tip.config(bg='grey')
    path_img=get_path('images')
    
    image_tip= PhotoImage(file = path_img+'blueTP.png')
    tip.label.config(bg='red',fg='white',bd=15,image=image_tip)
    
    
    mylabel= Label(root,text='MOS')
    mylabel.pack(pady=50)
    
    
    
    tip.bind_widget(mylabel,balloonmsg='MOS stands for "Mean Opinion Score" \n and it calculates the quality of internet service to provide the best audio quality to our customers. \n\n Formula; 1 * 0.035* R + 0.000007* R *(R-60) * (100-R)')
    
    root.mainloop()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-14
      • 1970-01-01
      • 2021-09-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多