Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reading TickOptionBox not working from change event function #422

pg-doceapower opened this Issue Mar 20, 2018 · 3 comments


None yet
2 participants
Copy link

pg-doceapower commented Mar 20, 2018

from the example below I can access the content of a tickOptionBox from the main thread but not in a function that is called on event

def tickOptionBox_has_changed(widgetFullName):
    print("DEBUG: widgetFullName=" + str(widgetFullName))
        print("DEBUG:optionBox content=" + str(optionBoxContent))
        print("DEBUG: ??? expected dictionary with option name and associated status")
app = gui()
# feedback objects
options=["val1", "val2", "val3"]
optionsTicked=[False, False, False]
ent=app.addTickOptionBox(myTitle, options, row=1, column=1, colspan=1 )
app.setOptionBoxSticky(myTitle, "both")
for idx in range(len(optionsTicked)):
    print("idx=" + str(idx))
    app.setOptionBox(myTitle, options[idx], value=False, callFunction=False, override=True)#optionsTicked[idx]
#ent.customFieldWhoAmI = guiObjName
app.setOptionBoxSubmitFunction(myTitle, tickOptionBox_has_changed)
print("DEBUG:optionBox content from main=" + str(optionBoxContent))

Console output

DEBUG:optionBox content from main={'val3': False, 'val2': False, 'val1': False}
DEBUG:optionBox content from submit event=
DEBUG: widgetFullName=val2
DEBUG: ??? expected dictionary with option nama and assotiated status

what would be the workaround?


This comment has been minimized.

Copy link

jarvisteach commented Mar 20, 2018

Interesting - this works fine on a regular option box, but not on a tick option box.

It looks like the tick option box is returning the item you ticked, rather than the name of the option box.

A workaround would be to use myTitle instead of widgetFullName - to get the values.
If there are multiple option boxes, link each one to a different change function, so you know where the change originated.

@jarvisteach jarvisteach added the bug label Mar 20, 2018

@jarvisteach jarvisteach added this to the 1.0 milestone Mar 20, 2018


This comment has been minimized.

Copy link

pg-doceapower commented Mar 20, 2018

jarvisteach added a commit that referenced this issue Mar 24, 2018

jarvisteach added a commit that referenced this issue Mar 24, 2018

Updated changeFunction on tickOptionBox #422
Previously ticking a tickOptionBox called changeFunction, passing the
item that was ticked.

It now passes the name of the optionBox.

This comment has been minimized.

Copy link

jarvisteach commented Mar 24, 2018

I've made a change, so this now returns the name of the optionBox, rather than the option being ticked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.