<commit_before>"""
1. start zenity Yes/No dialog on Xvfb
2. discover buttons using :mod:`discogui.buttons` module
3. click first button, print return code
4. click second button, print return code
"""
from discogui.buttons import discover_buttons
from discogui.mouse import PyMouse
from easyprocess import EasyProcess
from pyvirtualdisplay import Display
from time import sleep
from entrypoint2 import entrypoint


def click_button_get_return_code(which_button):
    with EasyProcess("zenity --question") as p:
        sleep(1)
        rectangles = discover_buttons()
        PyMouse().click(*rectangles[which_button].center)
        return p.wait().return_code

@entrypoint
def main():
    with Display():
        print(click_button_get_return_code(0))
        print(click_button_get_return_code(1))

<commit_msg>fix example<commit_after>"""
1. start zenity Yes/No dialog on Xvfb
2. discover buttons using :mod:`discogui.buttons` module
3. click first button, print return code
4. click second button, print return code
"""
from discogui.buttons import discover_buttons
from discogui.mouse import PyMouse
from easyprocess import EasyProcess
from pyvirtualdisplay import Display
from time import sleep
from entrypoint2 import entrypoint


def click_button_get_return_code(which_button):
    with EasyProcess("zenity --question") as p:
        sleep(1)
        rectangles = discover_buttons()
        PyMouse().click(*rectangles[which_button].center)
        return p.wait().return_code

@entrypoint
def main():
    with Display():
        print(click_button_get_return_code(0))
    with Display():
        print(click_button_get_return_code(1))

{'fraction_non_alphanumeric': 0.08206686930091185, 'fraction_numerical': 0.009726443768996961, 'mean_word_length': 4.432343234323432, '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': '7198738', 'n_tokens_mistral': 470, 'n_tokens_neox': 465, 'n_words': 147}