Exemple #1
0
def test_ui_textbox(recording=False):
    filename = "test_ui_textbox"
    recording_filename = pjoin(DATA_DIR, filename + ".log.gz")
    expected_events_counts_filename = pjoin(DATA_DIR, filename + ".json")

    # TextBox
    textbox_test = ui.TextBox2D(height=3, width=10, text="Text")

    another_textbox_test = ui.TextBox2D(height=3, width=10, text="Enter Text")
    another_textbox_test.set_message("Enter Text")

    # Assign the counter callback to every possible event.
    event_counter = EventCounter()
    event_counter.monitor(textbox_test)

    current_size = (600, 600)
    show_manager = window.ShowManager(size=current_size, title="FURY TextBox")

    show_manager.scene.add(textbox_test)

    if recording:
        show_manager.record_events_to_file(recording_filename)
        print(list(event_counter.events_counts.items()))
        event_counter.save(expected_events_counts_filename)

    else:
        show_manager.play_events_from_file(recording_filename)
        expected = EventCounter.load(expected_events_counts_filename)
        event_counter.check_counts(expected)
Exemple #2
0
from fury import ui, window

textbox = ui.TextBox2D(100, 100)

current_size = (800, 800)
show_manager = window.ShowManager(size=current_size, title="DIPY UI Example")
show_manager.scene.add(textbox)
show_manager.start()
from fury import ui, window
from fury.data import read_viz_icons, fetch_viz_icons

textbox1 = ui.TextBox2D(50,
                        20,
                        position=(330, 300),
                        text="Element 1" + " " * 8)
button_right = ui.Button2D(icon_fnames=[
    ('square', read_viz_icons(fname='circle-right.png'))
],
                           position=(295, 295),
                           size=(30, 30))

textbox2 = ui.TextBox2D(50,
                        20,
                        position=(330, 270),
                        text="Element 2" + " " * 8)
button_down = ui.Button2D(icon_fnames=[
    ('square', read_viz_icons(fname='circle-down.png'))
],
                          position=(295, 265),
                          size=(30, 30))

content = ui.Panel2D(size=(170, 100), color=(1, 1, 1), align="left")
content.center = (330, 330)

textbox = ui.TextBox2D(50, 10, text="Hello World!!")
content.add_element(textbox, (20, 50))

elements = [textbox1, button_right, button_down, content, textbox2, textbox]
Exemple #4
0
from fury import ui, window
from fury.data import read_viz_icons, fetch_viz_icons

textbox = ui.TextBox2D(50, 20, position=(300, 400), text=" "*8 + "23")
button_up = ui.Button2D(icon_fnames=[('square', read_viz_icons(fname='circle-up.png'))], position=(365,408), size=(15,15))
button_down = ui.Button2D(icon_fnames=[('square', read_viz_icons(fname='circle-down.png'))], position=(365,394), size=(15,15))

current_size = (800, 800)
show_manager = window.ShowManager(size=current_size, title="Spinner UI Example")
show_manager.scene.add(textbox)
show_manager.scene.add(button_up)
show_manager.scene.add(button_down)
show_manager.start()