jeudi 18 novembre 2021

Tkinter Checkbox

I am having some issues with Tkinter check box.

    comp_report_btn = Button(root, text="Get Deficiencies",
                             command=lambda: [get_tm(date_from.get(), date_to.get(), var1.get())])
    comp_report_btn.grid(row=8, column=0, columnspan=2, pady=10, padx=10, ipadx=50)

    var1 = IntVar()
    all_check = Checkbutton(root, text='Selected Ships', variable=var1, onvalue=1, offvalue=0)
    all_check.grid(row=7, column=0, columnspan=2, pady=10, padx=0, ipadx=10)

I want to pass 0 or 1 from the checkbox into the function get_tm. In that function I'm using if var1 == 0: check='Y'

At this point I have 2 issued. One is that no matter what the var1value is always 0. And the second is that when I used the if condition I get the following error: lxml.etree.ParserError: Document is empty. Thanks for any help.




Aucun commentaire:

Enregistrer un commentaire