<commit_before>from rctkdemos.demos import serve_demo, standalone
from rctk.widgets import CheckBox, CheckBoxGroup, StaticText
from rctk.layouts import HBox

class Demo(object):
    title = "CheckBox"
    description = "Demonstrates the CheckBox control"

    def build(self, tk, parent):
        parent.setLayout(HBox())
        box1 = CheckBox(tk)
        group1 = CheckBoxGroup(tk)
        box2 = CheckBox(tk, checked=True, value="Option 1", group=group1)
        box3 = CheckBox(tk, group=group1, value="Option 2")
        box4 = CheckBox(tk, group=group1, value="Option 3")
        parent.append(box1)
        parent.append(box2)
        parent.append(box3)
        parent.append(box4)
        box1.checked = True

        selection = StaticText(tk, text=group1.value)
        parent.append(selection)
        def handle_group(e):
            selection.text = group1.value
        group1.click = handle_group


if __name__ == '__main__':
    serve_demo(Demo)

Standalone = standalone(Demo)<commit_msg>working radiobutton/group demo<commit_after>from rctkdemos.demos import serve_demo, standalone
from rctk.widgets import RadioButton, RadioGroup, StaticText
from rctk.layouts import VBox

class Demo(object):
    title = "CheckBox"
    description = "Demonstrates the CheckBox control"

    def build(self, tk, parent):
        parent.setLayout(VBox())
        b1 = RadioButton(tk, text="Option 1", value=1)
        b2 = RadioButton(tk, text="Option 2", value=2)
        b3 = RadioButton(tk, text="Option 3", value=3)
        b4 = RadioButton(tk, text="Option 4", value=4)
        parent.append(b1)
        parent.append(b2)
        parent.append(b3)
        parent.append(b4)

        def handle_group(e):
            selection.text = "Selected: %d" % group.value
        group = RadioGroup(b1, b2, b3, b4)
        group.selected = b3
        group.click = handle_group

        selection = StaticText(tk, text="Selected: %d" % group.value)
        parent.append(selection)



if __name__ == '__main__':
    serve_demo(Demo)

Standalone = standalone(Demo)
{'fraction_non_alphanumeric': 0.10970873786407767, 'fraction_numerical': 0.019417475728155338, 'mean_word_length': 2.9710982658959537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2956044', 'n_tokens_mistral': 683, 'n_tokens_neox': 652, 'n_words': 152}