Ejemplo n.º 1
0
        async for a in sm.aiter(FAST_DIVISION):
            self.pos = a * self.start + (1 - a) * self.pos
            self.color = COLOR_LERP * a * self.start_color + (
                1 - COLOR_LERP * a) * self.color
            self.top = round(self.pos.real)
            self.left = round(self.pos.imag)
            if self.top == self.start.real and self.left == self.start.imag and self.start_color == int(
                    self.color):
                return

    def refresh(self):
        self.window.chgat(0, 0, colors.palette["rainbow"][int(self.color)])


with ScreenManager() as sm:
    colors.rainbow_gradient(COLORS)

    # Starting colors of LOGO:
    c = np.full((HEIGHT, WIDTH), BLUE)
    c[-7:] = c[-13:-7, -41:] = c[-14, -17:] = c[-20:-14, -15:] = YELLOW

    # Create a Particle for each non-space character in the logo
    for y, row in enumerate(LOGO.splitlines()):
        for x, char in enumerate(row):
            if char != " ":
                sm.root.add_widget(
                    Particle(y, x, character=char, color=c[y, x]))

    cursor = sm.root.new_widget(HEIGHT // 2,
                                WIDTH // 2,
                                3,
Ejemplo n.º 2
0
    def refresh(self):
        if self.is_selected:
            if self.border_style != "heavy":
                self.border("heavy", colors.BLUE_ON_BLACK)
        elif self.border_style != "light":
            self.border()

        super().refresh()


class Notepad(Window, TextPad):
    ...


with ScreenManager() as sm:
    rainbow = cycle(colors.rainbow_gradient(20))
    blue_to_purple = colors.gradient(20, (0, 255, 255), (103, 15, 215),
                                     "blue_to_purple")

    sm.root.add_widget(Notepad(0, 0, size_hint=(.5, .5)))
    ur = sm.root.new_widget(pos_hint=(.0, .5),
                            size_hint=(.5, .5),
                            create_with=Window)
    lr = sm.root.new_widget(pos_hint=(.5, .0),
                            size_hint=(.5, .5),
                            create_with=Window)
    ll = sm.root.new_widget(pos_hint=(.5, .5),
                            size_hint=(.5, .5),
                            create_with=Window)

    # Setup Menubar in upper-right window
Ejemplo n.º 3
0
with ScreenManager() as sm:
    # Define some new colors:
    colors.PURPLE = 103, 15, 215
    colors.FUCHSIA = 181, 52, 78
    colors.ORANGE = 224, 132, 33
    colors.TEAL = 17, 163, 112

    widget = sm.root.new_widget(10, 10, 10, 11, create_with="ArrayWin")
    widget.colors[0::4] = colors.PURPLE_ON_BLACK
    widget.colors[1::4] = colors.FUCHSIA_ON_YELLOW
    widget.colors[2::4] = colors.ORANGE_ON_PURPLE
    widget.colors[3::4] = colors.TEAL_ON_WHITE
    widget[:] = "Color Test!"

    sm.root.refresh()
    sm.pause()

    rainbow = cycle(colors.rainbow_gradient(
        20))  # Create a rainbow gradient with 20 colors
    purp_to_teal = cycle(
        colors.gradient(20, (103, 15, 215), (17, 163, 112), "purple_to_teal"))

    def update():
        widget.colors[:, :5] = next(rainbow)
        widget.colors[:, 5:] = next(purp_to_teal)
        widget.root.refresh()

    sm.schedule(update, delay=.1)
    sm.run()

print(colors)