import widgets # Option chooser example. WINDOW_WIDTH = 1024 WINDOW_HEIGHT = 728 pygame.init() pygame.font.init screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) clock = pygame.time.Clock() FPS = 60 running = True if __name__ == "__main__": panel = widgets.Panel(core.Grid((3, 20), (WINDOW_WIDTH, WINDOW_HEIGHT)), None, None, (0, 0)) panel.set_color((155, 155, 155, 255)) opt = widgets.OptionChooser(panel, (0, 5), ["Blue", "Orange", "Black", "White", "Red"], 2) # Changing the images of the buttons, from left to right. # They must be changed prior to spanning, otherwise you'll get nasty dimension issues. opt.set_images(("gfx/black_arrow_0.png", "gfx/black_arrow_1.png")) opt.set_span((2, 3)) opt.set_border(core.BLACK, 16) opt.text_color = core.RED opt.bold = True opt.italic = True opt.update_text() def redraw():
import widgets # Widget border example. WINDOW_WIDTH = 1024 WINDOW_HEIGHT = 728 pygame.init() pygame.font.init screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) clock = pygame.time.Clock() FPS = 60 running = True if __name__ == "__main__": panel = widgets.Panel(core.Grid((3, 7), (WINDOW_WIDTH, WINDOW_HEIGHT)), None, None, (0, 0)) panel.set_color((55, 55, 55, 255)) midpanel = widgets.Panel( core.Grid((1, 1), (panel.get_cell_width(), panel.get_cell_height())), panel, (1, 1), None) midpanel.set_color((0, 0, 0, 255)) midpanel.set_span((0, 6)) button = widgets.TextButton(midpanel, (0, 0), core.Text("Button " + str(0), 32)) button.set_color((0, 100, 0, 255)) button.set_border((255, 0, 0, 255), 16) def redraw(): pygame.display.flip() screen.fill((0, 0, 0)) panel.draw(screen)