-1
from tkinter import *

class btr(Tk):
    def __init__(self):
        super(btr, self).__init__()
        self.ticket = Text(self,height=12, width =70, bd = '10').grid(row=0, column=0)
        self.ticket.insert(INSERT, "abcdefg")
        self.ticket.insert(END, "abcdefg")

    btr().mainloop()

Please help me. I am very new to tkinter(Python). I was making a GUI Program but I getting this error AttributeError: 'NoneType' object has no attribute 'insert' please help me as fast as you can.

baptiste
  • 1,107
  • 2
  • 15
  • 30

1 Answers1

0

You are trying set .grid() for Text, not for its instance.

Simply set .grid() after created an instance of Text:

class Btr(Tk):
    def __init__(self):
        super(Btr, self).__init__()
        self.ticket = Text(self, height=12, width=70, bd='10')
        self.ticket.grid(row=0, column=0)

        self.ticket.insert(INSERT, "abcdefccg")
        self.ticket.insert(END, "abcdefgx")


Btr().mainloop()
luipenox
  • 123
  • 5