Bar oo.
Bar oo.

Reputation: 21

partial doesn`t pass Tkinter argument

I am creating a python application. whenever I print the argument (the content of the entry widget) I get nothing instead of what I entered. here is my code:

class App(tk.Tk):
    def __init__(self):
        super().__init__()
        self.withdraw()
        self.root1 = Tk()  
        self.root1.geometry('800x690')  
        self.root1.title('1')

        self.root2 = Tk()  
        self.root2.geometry('800x690')  
        self.root2.title('2')
        self.root2.withdraw()

        usernameLabel3 = Label(self.root2, text="Asset category",font=("Arial", 10),height= 1, 
        width=15)
        self.u3 = StringVar(None)
        usrIn3 = Entry(self.root2, textvariable = self.u3, width = 30)
        bt = ttk.Button(self.root2 , text = 'func', command = partial(func,self.u3))
    def func(self,u3):
        print(u3.get())

when I write the func before the App class the result was same.How can I get the argument I entered?

Upvotes: 0

Views: 17

Answers (0)

Related Questions