#!/usr/bin/env python3 """A single place-holder should be displayed.""" import pyglet import glooey import demo_helpers print(__doc__) window = pyglet.window.Window() batch = pyglet.graphics.Batch() root = glooey.Gui(window, batch=batch) bin = glooey.Bin(padding=5) widget = glooey.PlaceHolder(100, 100) bin.add(widget) root.add(bin) demo_helpers.install_padding_hotkeys(window, bin) demo_helpers.install_placement_hotkeys(window, bin) pyglet.app.run()
if symbol == key.O: widget = PlaceHolder(20, 20, color=yellow) vbox.add_back(widget, size, placement) @window.event def on_mouse_press(x, y, button, modifiers): from pyglet.window import key for widget in vbox: if widget.is_under_mouse(x, y): break else: return if button == pyglet.window.mouse.LEFT: color = blue if widget.color == green else green new_widget = PlaceHolder(20, 20, color=color) vbox.replace(widget, new_widget) if button == pyglet.window.mouse.RIGHT: vbox.remove(widget) demo_helpers.install_padding_hotkeys(window, vbox) demo_helpers.install_placement_hotkeys(window, vbox) pyglet.app.run()
import pyglet import demo_helpers import glooey import glooey.drawing print(__doc__) window = pyglet.window.Window() batch = pyglet.graphics.Batch() root = glooey.Gui(window, batch=batch) grid = glooey.Grid(padding=5) grid.set_row_height(0, 0) grid.set_col_width(0, 0) for row in range(5): for col in range(5): color = glooey.drawing.rainbow_cycle[row] placement = 'fill' if row == col else None widget = glooey.PlaceHolder(30, 30, color=color) grid.add(row, col, widget, placement=placement) root.add(grid) demo_helpers.install_padding_hotkeys(window, grid) demo_helpers.install_placement_hotkeys(window, grid) pyglet.app.run()
#!/usr/bin/env python3 import pyglet import demo_helpers from glooey import * from glooey.drawing import * window = pyglet.window.Window() batch = pyglet.graphics.Batch() root = Gui(window, batch=batch) stack = Stack() stack.placement = 'center' stack.add(PlaceHolder(400, 400, color=blue)) stack.add(PlaceHolder(350, 350, color=green)) stack.add(PlaceHolder(300, 300, color=yellow)) stack.add(PlaceHolder(250, 250, color=orange)) stack.add(PlaceHolder(200, 200, color=red)) root.add(stack) demo_helpers.install_padding_hotkeys(window, stack) demo_helpers.install_placement_hotkeys(window, stack) pyglet.app.run()