Dialogs

Easygraphics provides many predefined dialogs to communicate with user interactively.

Output Dialogs

show_html(title, text, width, height) Displays some html text in a window.
show_image_dialog(image, title) Display the image in a dialog.
show_lists_table(*args, column_names, title, …) Displays list of datas in a table
show_message(message, title) Simple message box.
show_objects(datas, fields, field_names, …) Displays list of objects in a table
show_text(title, text, width, height) Displays some text in a window.
show_table(datas, fields, field_names, …) Displays list of objects in a table
show_code(title, code, width, height) Displays some text in a window, in a monospace font.
show_file(file_name, title, file_type, …) Displays a file in a window.

Input Dialogs

get_choice(message, title, choices) Simple dialog to ask a user to select an item within a drop-down list
get_color([color]) Display a color picker and return the selected color
get_continue_or_cancel(question, title, …) Continue or cancel question, shown as a warning (i.e.
get_date(title) Calendar widget
get_directory_name(title) Gets the name (full path) of an existing directory
get_file_names(title, filter) Gets the names (full path) of existing files
get_float(message, title, default_value, …) Simple dialog to ask a user to select a floating point number within a certain range and a maximum precision.
get_int(message, title, default_value, min_, …) Simple dialog to ask a user to select an integer within a certain range.
get_list_of_choices(title, choices) Show a list of possible choices to be selected.
get_many_strings(title, labels, masks) Multiple strings input
get_new_password(title, labels) Change password input box.
get_password(message, title) Simple password input box.
get_save_file_name(title, filter) Gets the name (full path) of of a file to be saved.
get_string(message, title, default_response) Simple text input box.
get_username_password(title, labels) User name and password input box.
get_yes_or_no(question, title) Simple yes or no question.

In the following program, click the graphics window to open a color dialog, select a color and set it as the background.

from easygraphics import *
from easygraphics.dialog import *

def main():
    init_graph(600, 400)
    set_render_mode(RenderMode.RENDER_MANUAL)

    while is_run():
        if has_mouse_msg():
            x, y, type, buttons = get_mouse_msg()
            if type == MouseMessageType.PRESS_MESSAGE:
                color = get_color(get_background_color())
                set_background_color(color)
        delay_fps(60)

    close_graph()

easy_run(main)