def onclick(self, event=None, label=None):
        textwid = None
        if (label is None and event is not None and
            event.Id in self.wids):
                textwid = self.wids[event.Id]
                label = textwid.GetLabel()
        if label is None:
            return
        if textwid is None and label is not None:
            textwid = self.ctrls[label]

        textwid.SetForegroundColour(self.SEL_FG)
        textwid.SetBackgroundColour(self.SEL_BG)
        if self.selected is not None and self.selected != textwid:
            self.selected.SetForegroundColour(self.REG_FG)
            self.selected.SetBackgroundColour(self.REG_BG)

        self.selected = textwid
        znum = self.syms.index(label)
        name = self.names[znum]

        self.tsym.SetLabel(label)
        self.title.SetLabel(name)
        self.tznum.SetLabel("{:d}".format(znum+1))
        if self.onselect is not None:
            self.onselect(elem=label, event=event)
        self.Refresh()
dataset/ETHPy150Open xraypy/xraylarch/plugins/wx/periodictable.py/PeriodicTablePanel.onclick/original