Sep-20-2020, 02:24 PM
The reason result.val() is always False is because you create the BooleanVar and never bind it to a control. result is used as an arg to the callback, but there is no control bound to result and no way to change the value of result.
result = tk.BooleanVar() search_members_button = ttk.Button(centersearch, text="Search", command=lambda: self.get_display_options_selected(result), state='active') search_members_button.grid(row=7, column=5, columnspan=2, pady=15)The reason your function always prints False is because you always print the value of the unbound BooleanVal result when what you really want is the value of the display_member_name Checkbutton IntVariable display_name_val.
def get_display_options_selected(self,result): self.result = result print("inside def before getting value", result.get()) # Using input arg self.result = self.display_name_val.get() print("inside def after getting value", result.get()) # Still using input arg return (self.result)