コード例 #1
0
import gooeypie as gp

app = gp.GooeyPieApp('Login')

user_label = gp.Label(app, "Username")
user_input = gp.Input(app)
pass_label = gp.Label(app, "Password")
pass_input = gp.Secret(app)

app.set_grid(2, 2)
app.add(user_label, 1, 1)
app.add(user_input, 1, 2)
app.add(pass_label, 2, 1)
app.add(pass_input, 2, 2)

app.run()
コード例 #2
0
import gooeypie as gp

app = gp.GooeyPieApp('Widget Gallery')
app.set_grid(16, 1)
app.width = 200

app.add(gp.Input(app), 1, 1, fill=True)
app.add(gp.Checkbox(app, 'Checkbox'), 2, 1)
app.add(gp.Label(app, 'Label'), 3, 1)
app.add(gp.Slider(app, 1, 10), 4, 1, fill=True)

style_label = gp.StyleLabel(app, 'StyleLabel')
style_label.font_name = 'Courier'
style_label.font_size = 16
style_label.font_weight = 'bold'
style_label.colour = '#FF6702'
style_label.background_colour = 'black'
app.add(style_label, 5, 1, align='center')

app.add(gp.Hyperlink(app, 'Hyperlink', '.'), 6, 1)
app.add(gp.Secret(app), 7, 1, fill=True)
app.add(gp.Listbox(app, [f'Listbox item {n}' for n in range(1, 7)]),
        8,
        1,
        fill=True)
app.add(gp.Textbox(app), 9, 1, fill=True)
app.add(gp.ImageButton(app, 'images/favicon.ico', None, '   ImageButton'),
        10,
        1,
        fill=True)
app.add(gp.Radiogroup(app, [f'Radio item {n}' for n in range(1, 4)]),
コード例 #3
0
float_label = gp.Label(widgets, 'Floats 0 to 1.0 (increment 0.1)')

# Number widgets
default_number = gp.Number(widgets, 1, 10)
inc_number = gp.Number(widgets, 0, 255, 5)
float_number = gp.Number(widgets, 0, 1, 0.1)

default_get = gp.Button(widgets, 'Get value', get_value)
inc_get = gp.Button(widgets, 'Get value', get_value)
float_get = gp.Button(widgets, 'Get value', get_value)

default_set = gp.Button(widgets, 'Set value to', set_value)
inc_set = gp.Button(widgets, 'Set value to', set_value)
float_set = gp.Button(widgets, 'Set value to', set_value)

default_set_value = gp.Input(widgets)
default_set_value.width = 8
default_set_value.margin_left = 0
inc_set_value = gp.Input(widgets)
inc_set_value.width = 8
inc_set_value.margin_left = 0
float_set_value = gp.Input(widgets)
float_set_value.width = 8
float_set_value.margin_left = 0

default_enable = gp.Button(widgets, 'Enable/disable', enable)
inc_enable = gp.Button(widgets, 'Enable/disable', enable)
float_enable = gp.Button(widgets, 'Enable/disable', enable)

default_read_only = gp.Button(widgets, 'Toggle readonly', read_only)
inc_read_only = gp.Button(widgets, 'Toggle readonly', read_only)
コード例 #4
0
import gooeypie as gp

app = gp.GooeyPieApp('Test')

# License container
license_container = gp.Container(app)

license_box_1 = gp.Input(license_container)
license_box_2 = gp.Input(license_container)
license_box_3 = gp.Input(license_container)
license_box_4 = gp.Input(license_container)
license_box_1.width = 5
license_box_2.width = 5
license_box_3.width = 5
license_box_4.width = 5

license_container.set_grid(1, 4)
license_container.add(license_box_1, 1, 1)
license_container.add(license_box_2, 1, 2)
license_container.add(license_box_3, 1, 3)
license_container.add(license_box_4, 1, 4)

# Buttons container
buttons_container = gp.Container(app)
register = gp.Button(buttons_container, 'Register', None)
cancel = gp.Button(buttons_container, 'Cancel', None)
buttons_container.set_grid(1, 2)
buttons_container.add(register, 1, 1)
buttons_container.add(cancel, 1, 2)

# Main window
コード例 #5
0
    length = length_slider.value

    # Create the password by choosing 'length' random characters
    new_password = ''
    for n in range(length):
        new_password += random.choice(password_chars)

    # Display the new password in the password input field
    password.text = new_password
    app.copy_to_clipboard(new_password)

app = gp.GooeyPieApp('Make a good password... please')

instructions = gp.Label(app, 'Set your desired password length using the slider')
length_slider = gp.Slider(app, 4, 30)
password = gp.Input(app)
password.justify = 'center'

length_slider.add_event_listener('change', make_password)

app.set_grid(3, 1)
app.add(instructions, 1, 1)
app.add(length_slider, 2, 1, fill=True)
app.add(password, 3, 1, fill=True)

# Set the default password length. This will also trigger the make_password() function
length_slider.value = 12

app.run()

コード例 #6
0
import gooeypie as gp

def say_hello(event):
    hello_label.text = f'Hello {name.text}!'

app = gp.GooeyPieApp('Hello!')

question = gp.Label(app, 'What is your name?')
name = gp.Input(app)
name.justify = 'center'
name.width = 30
hello_button = gp.Button(app, 'Say Hello', say_hello)
hello_label = gp.Label(app, '')

app.set_grid(4, 1)
app.add(question, 1, 1, align='center')
app.add(name, 2, 1)
app.add(hello_button, 3, 1, align='center')
app.add(hello_label, 4, 1, align='center')

app.run()
コード例 #7
0
scroll_listbox.width = 30
scrollbar_option = gp.Dropdown(scrolled_listbox_container,
                               ['auto', 'visible', 'hidden'])
scrollbar_option.selected_index = 0
scrollbar_option.add_event_listener('select', set_scrollbar)
scrolled_listbox_container.set_grid(2, 1)
scrolled_listbox_container.set_row_weights(1, 0)
scrolled_listbox_container.add(scroll_listbox, 1, 1, fill=True, stretch=True)
scrolled_listbox_container.add(scrollbar_option, 2, 1)

# Testing operations Container
test_container = gp.LabelContainer(app, 'Tests')
setter_button = gp.Button(test_container, 'Set some random values', add_items)
items_button = gp.Button(test_container, 'Get Items', display_items)
add_button = gp.Button(test_container, 'Add Item', add_item)
add_what = gp.Input(test_container)
add_start_button = gp.Button(test_container, 'Add Item to start',
                             add_item_to_start)
add_start_what = gp.Input(test_container)
remove_button = gp.Button(test_container, 'Delete item at index', remove_item)
remove_where = gp.Input(test_container)
selected_button = gp.Button(test_container, 'Get selected value(s)',
                            get_selected)
selected_index_button = gp.Button(test_container, 'Get selected index(es)',
                                  get_selected_index)
select_button = gp.Button(test_container, 'Select at index(es)', select_at)
select_where = gp.Input(test_container)
select_all = gp.Button(test_container, 'Select all', select)
select_none = gp.Button(test_container, 'Select none', select)
remove_selection = gp.Button(test_container, 'Remove selected',
                             remove_selected)