w, h = app.window_size dw, dh = get_desktop_size() x = (dw - w) / 2 y = (dh - h) / 2 app.window_position = (x, y) app = App(title="Test Window Position", window_position=(400, 400), center=( UIntSpin( id="x", label="X:", callback=set_window_position, ), UIntSpin( id="y", label="Y:", callback=set_window_position, ), Button( id="center", label="Center", callback=center_window, ), )) app.idle_add(fill_window_position) run()
janela = App( title='Chaveiro', center=(TabelaChaveiro( 'tabela', 'Sites', senha='1234', types=(str, str, str, str), headers=('titulo', 'URL', 'login', 'senha'), expand_columns_indexes=(0, 1), editable=True, data_changed_callback=lambda app, ctr, vlr: tabela.mudou()), Group('duas-celulas', horizontal=True, children=( Group('area-senha', label='Senha-mestre', children=(Label('mensagem-senha', label=MSG_SENHA_ABRIR), Password( 'senha', active=True, persistent=False, callback=lambda app, campo, valor: tabela.senha_digitada(campo, valor), ))), Button('acao', label='Ler e decifrar', callback=lambda app, btn: tabela.carregar()), QuitButton(), ))))
#!/usr/bin/env python2 from eagle import App, CheckBox, run def toggle_decoration(app, cb, value): app.window_decorated = value App( title="Change Window Decoration", window_decorated=False, center=CheckBox( id="cb", label="Window is decorated", callback=toggle_decoration, ), ) run()
width, height = app.window_size app["width"] = width app["height"] = height def set_window_size(app, *ignored): width = app["width"] height = app["height"] if width and height: app.window_size = (width, height) app = App(title="Test Window Size", window_size=(400, 400), center=( UIntSpin( id="width", label="Width:", callback=set_window_size, ), UIntSpin( id="height", label="Height:", callback=set_window_size, ), )) app.idle_add(fill_window_size) run()
def fill_window_size(app): width, height = app.window_size app["width"] = width app["height"] = height def set_window_size(app, *ignored): width = app["width"] height = app["height"] if width and height: app.window_size = (width, height) app = App(title="Test Window Size", window_size=(400, 400), center=(UIntSpin(id="width", label="Width:", callback=set_window_size, ), UIntSpin(id="height", label="Height:", callback=set_window_size, ), ) ) app.idle_add(fill_window_size) run()
#!/usr/bin/env python2 from eagle import App, Entry, run def change_title(app, entry, value): app.title = value App(title="Change this title", center=Entry(id="e0", label="New title:", callback=change_title)) run()