Skip to content

cb.current() not working when only one Checkbox selected #5

Description

@DavidVoellm

When only one CheckBox is selected cb.current() throws an Error, because self.get() returns the selected value as a String and not as array.
To solve this self.get() needs to be checked if is String and converted to array.

Here: (in method current)

        retarr = self.get()
        if type(retarr) == str: retarr = [retarr] # EDIT BY DABVIT
        if len(retarr) == 0:
            return -1
        elif len(retarr) == 1:
            if retarr[0] == '':
                return -1
            else:
                return self.cget('values').index(retarr[0])
        else:
            return [self.cget('values').index(i) for i in retarr] # EDIT BY DABVIT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions