I have a tkinter button, that when pressed should trigger creation of a custom class (class "manual_entry").
The custom class in its init() has creation of tkinter toplevel window. Snippet of code for clarify:
def __init__(self,main,myobject):
manual=tk.Toplevel()
something something
This toplevel windows does something to myobject, which is another class irrelevant to question.
When I call this class, for example:
variable=manual_entry(main,myobject)
it works perfectly. But what I specifically want is that this class be created upon a button prompt from tkinter main window. Snipped of code:
def create_ent(main,myobject):
variable=manual_entry(main,myobject)
tk.Button(master=main,text="!",command=create_ent(main,museobj).grid()
Now what I should have is a tkinter window containing only button "!" which when I press, I get my own toplevel window. But instead, I simply get toplevel window ("manual") without even touching "!" button.
Upon further experimentation, if I were to do this
def test(a):
print(a)
return()
a="test"
tk.Button(master=main,text="!",command=beg(a)).grid()
main.mainloop()
What I get is automatically printed "test", without any prompt for button pressing.
What I want, in a nutshell, is a way to pass function that takes arguments as a tkinter command.
lambda:command=lambda: create_ent(main,museobj).