Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PYTHON 3.7 _tkinter.TclError: invalid command name "tixBalloon"

Hello I am trying to create a button that will show description when hovered. similar to html img tag "alt" I decide to use "tkinter.pix" with Balloon() But I am having an error: _tkinter.TclError: invalid command name "tixBalloon".

from tkinter import *
from tkinter import tix


class MyClass:

    def __init__(self, master):
        self.master = master
        self.btn_1 = Button(self.master, text="Button")
        self.btn_1.pack()

        self.bal = tix.Balloon(self.master)

        self.bal.bind_widget(self.btn_1, balloonmsg="Hello")
root = Tk()
app= MyClass(root)
root.mainloop()
like image 254
Evan Avatar asked Aug 24 '18 09:08

Evan


1 Answers

When you use tix widgets, you also need to use the tix version of Tk().
So replace root = Tk() with:

root = tix.Tk()
like image 91
fhdrsdg Avatar answered Oct 31 '22 14:10

fhdrsdg