dimanche 6 mars 2022

Inconsistent outcomes from Tkinter Checkbutton code

I am wring a small app in python/tkinter and have a screen with two checkboxes that impact how the date is processed. I want both boxes to have a default position to checked or selected and the following seemingly identical code establishes the opening position of each.

I am struggling to see any difference between the two sets of statements - I am pretty sure I probably copied one block to create the other - yet when the code runs the first checkbox defaults to selected but the second is unchecked.

I am importing both tkinter as * and ttk but I believe these to be instances of the tkinter basic Checkbutton.

Any comments or pointers as to why two seemingly identical sets of code should react differently would be gratefully received.

    var_ignore_clsd = IntVar()
    chk_ignore_clsd = Checkbutton(aBlock, text='Ignore closed orders', variable=var_ignore_clsd)
    chk_ignore_clsd.grid(sticky=W, row=0, column=6, padx=(5,0), pady=(8,0))
    chk_ignore_clsd.configure(bg=param_value[1])
    chk_ignore_clsd.select()
    var_close_after = IntVar()
    chk_close_after = Checkbutton(aBlock, text='Close order when invoice processed', variable=var_close_after)
    chk_close_after.grid(sticky=W, row=7, column=4, padx=(5,0), pady=(8,0), columnspan=2)
    chk_close_after.configure(bg=param_value[1])
    chk_close_after.select()    



Aucun commentaire:

Enregistrer un commentaire