<commit_before>from rctkdemos.demos import serve_demo, standalone
from rctk.widgets import StaticText, Button
from rctk.layouts import GridLayout

class Demo(object):
    title = "ClickHandler"
    description = "Demonstrates a click handler on a button"

    def __init__(self):
        self.counter = 0

    def click_handler(self, event):
        self.counter += 1
        if self.counter == 1:
            self.message.text = "%d click" % self.counter
        else:
            self.message.text = "%d clicks" % self.counter

    def build(self, tk, parent):
        parent.setLayout(GridLayout(columns=2))

        button = Button(tk, "Click me")
        self.message = StaticText(tk, "0 clicks")

        button.click = self.click_handler

        parent.append(self.message)
        parent.append(button)

Standalone = standalone(Demo)

if __name__ == '__main__':
    serve_demo(Demo)
<commit_msg>no need for a gridlayout - default VBox looks better anyway<commit_after>from rctkdemos.demos import serve_demo, standalone
from rctk.widgets import StaticText, Button
from rctk.layouts import GridLayout

class Demo(object):
    title = "ClickHandler"
    description = "Demonstrates a click handler on a button"

    def __init__(self):
        self.counter = 0

    def click_handler(self, event):
        self.counter += 1
        if self.counter == 1:
            self.message.text = "%d click" % self.counter
        else:
            self.message.text = "%d clicks" % self.counter

    def build(self, tk, parent):
        button = Button(tk, "Click me")
        self.message = StaticText(tk, "0 clicks")

        button.click = self.click_handler

        parent.append(self.message)
        parent.append(button)

Standalone = standalone(Demo)

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

{'fraction_non_alphanumeric': 0.10138504155124654, 'fraction_numerical': 0.004986149584487534, 'mean_word_length': 2.7546777546777546, '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': '3918027', 'n_tokens_mistral': 570, 'n_tokens_neox': 534, 'n_words': 148}