예제 #1
0
    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()
예제 #2
0
    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()
예제 #3
0
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()