0
I wanted to create a text in a window and, pressing a button, my text appear on the console. My code is this:
from tkinter import *
class janela:
    def __init__ (self, janela):
        self.frame=Frame()
        self.frame.config(height=300,width=300,bg='black')
        self.frame.pack()
        janela.config(bg='black')
        janela.title('TITULO')
        text1 = Text (self.frame, width=20, height=5)
        text1.pack()
        confirm = Button (self.frame, text='Confirmar texto', fg='red', command=
                            lambda: print(text1))
        confirm.pack()
            
            
jan1 = Tk()
janela(jan1)
jan1.mainloop()