I'm new with Tkinter module and i tried to use OOP with Tkinter. Mycode has no error but the Listbox widget has no output , here is my code :
from tkinter import *
class Test:
word = ""
def __init__(seld , w):
self.word = w.get()
def Try(self):
return self.word
win = Tk()
a = StringVar()
win.geometry("750x750")
l1 = Label(win , text = "Name").grid(row = 0 , column = 0)
e1 = Entry(win , textvariable = a).grid(row = 0 , column = 1)
t = Test(a)
b = Button(win , text = "Show" , command = t.Try).grid(row = 1 , column = 0)
lb = Listbox(win , width = 50)
lb.grid(row = 2 , column = 0)
lb.insert(1 , t.Try)
win.mainloop()
can someone help me ? thanks