A
A
Artem [email protected]2018-05-29 12:26:43
Python
Artem [email protected], 2018-05-29 12:26:43

How to pass parameter to button function?

There is an execute function in the module that I connect to the current script. There are fields on the form, for example, year and month, how to transfer data from these fields when clicking on the button?
I do this and it doesn't work:

from tkinter import *
from modul1 import *
root = Tk()
year = Entry()
mont = Entry() 

button1 = Button(root, text = 'Выполнить', command = modul1.execute(year.get(), mont.get()))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-05-29
@file2

Button(root, text = 'Выполнить', command = lambda: modul1.execute(year.get(), mont.get()))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question