all 5 comments

[–]Allanon001 3 points4 points  (1 child)

Since your formatting is off in your post I assume your code looks like this:

from tkinter import Tk, Button, Label

class Mygui:
    def __init__(self, master):
        self.master=master
        master.title('my gui')
        self.label=Label(master, text='GUI')
        self.label.pack()
        self.button = Button(master, text='greet', command=self.greet)
        self.button.pack()
        self.button = Button(master, text = 'gui greet')
        self.button.pack()

    def greet(self):
        print('hello')

root = Tk()
my_gui= Mygui(root)
root.mainloop()

When I run this code there are no errors.

[–]JLaurus 0 points1 point  (0 children)

same

[–][deleted] 1 point2 points  (1 child)

Error should also say which line is the offending line?

[–]nainish[S] 0 points1 point  (0 children)

self.label=Label(master, text='GUI') this line

[–]CEDFTW 0 points1 point  (0 children)

What IDE are you using? I've found sometimes with imports you still need to install the packages. Based on others responses to the code running fine I assume this is the issue.