Display message when hovering over something with mouse cursor in Python

前端 未结 7 792
走了就别回头了
走了就别回头了 2020-12-01 10:57

I have a GUI made with TKinter in Python. I would like to be able to display a message when my mouse cursor goes, for example, on top of a label or button. The purpose of th

7条回答
  •  佛祖请我去吃肉
    2020-12-01 11:23

    If anyone is on Mac OSX and tool tip isn't working, check out the example in:

    https://github.com/python/cpython/blob/master/Lib/idlelib/tooltip.py

    Basically, the two lines that made it work for me on Mac OSX were:

        tw.update_idletasks()  # Needed on MacOS -- see #34275.
        tw.lift()  # work around bug in Tk 8.5.18+ (issue #24570)
    

提交回复
热议问题