I want to execute an extra function in the command if the checkbox is ticked, and if it is not ticked, then i don't want my program to execute it, how can i do that?
I.e, I want to execute CreateWallet Function if the checkbox is ticked, however, I don't want to disable the addchrome() one!
Thanks in advance!
from tkinter import *
from lib.SUI import WizardLand, RequestTokens, ExampleNFT, addchrome, CreateWallet
root = Tk()
root.title('Tool')
root.state('zoomed')
button_quit = Button(
root,
text="Exit Program",
command=root.quit
)
button1 = Button(
root,
text="Start",
command=lambda: [
addchrome(),
CreateWallet()]
)
#Options
var = IntVar()
opt1 = Checkbutton(
root,
text = "Create Wallet",
variable=var
)
lambdawith a list to execute multiple functions. If the Button'scommand=referred to an ordinary function, defined withdef, then you could trivially useifstatements (and all of the other power of the Python language) to make things happen conditionally.