I am creating a Python GUI using Tkinter with Python 2.7. The value of the checkbox needs to be registered in a variable and displayed to the user. On running the script file, the checkboxes work absolutely fine and its value is recorded.
However, after converting it to exe using Cx_Freeze, the checkbox though ticked for 1, does not indicate that value. It records 0, instead. Here is an excerpt of the code for the checkbutton portion. Please help.
global On_Off
global CheckVar1
global On_Off_state
def On_Off_state(*args):
On_Off = CheckVar1.get()
On_Off = 0
CheckVar1 = IntVar()
CheckVar1.trace_variable("w", On_Off_state)
global OnOff
OnOff = Checkbutton(label2, text = "On", variable = CheckVar1, onvalue = 1, offvalue = 0, height=1, width = 10,anchor = W, bg = '#0e5dd6', disabledforeground = '#FFFFFF')
OnOff.grid(row = 4, column = 2, padx = 10, sticky = W)
global change_On_Off_state
def change_On_Off_state(*args):
CheckVar1.set(*args)
global set_value1
def set_value1():
global row_OnOff
global col_OnOff
change_On_Off_state(CheckVar1.get())
d = CheckVar1.get()
Aucun commentaire:
Enregistrer un commentaire