Valtok
Valtok

Reputation: 1

Can someone explain to me why im getting this error

Im trying to make a tkinter window but this shows up for some reason, i really dont know what i did wrong

root.title('RNG')
root.geometry('300x300')
button = Button(root, text = 'talk', bd = '5',)
button.pack(side = 'top')
text = Text(master=BOTTOM)
text.pack(side=BOTTOM)

the error:

  File "/home/valtok/PycharmProjects/tests/waifu simulator/RNG.py", line 65, in <module>
    text = Text (master=BOTTOM)
  File "/usr/lib/python3.8/tkinter/__init__.py", line 3554, in __init__
    Widget.__init__(self, master, 'text', cnf, kw)
  File "/usr/lib/python3.8/tkinter/__init__.py", line 2561, in __init__
    BaseWidget._setup(self, master, cnf)
  File "/usr/lib/python3.8/tkinter/__init__.py", line 2530, in _setup
    self.tk = master.tk
AttributeError: 'str' object has no attribute 'tk'

Upvotes: 0

Views: 39

Answers (1)

Hari shankar
Hari shankar

Reputation: 11

Instead of this:

text = Text(master=BOTTOM)

Write this:

text = Text(master=root)

Upvotes: 1

Related Questions