from models.TextModels import * from views.ImageView import * from views.TextViews import * from ResourceLoader import * loader = ResourceLoader() chk_image = loader.load_resource_by_name_and_type('check', 'image') x_image = loader.load_resource_by_name_and_type('x', 'image') chk_view = ImageView(ImageModel(chk_image)) x_view = ImageView(ImageModel(x_image)) font = loader.load_resources_by_type('font')[0] stage = Stage() scene = Scene('Toggle and Slider Test') scene.width = stage.width scene.height = stage.height container = Scene('Options Container') container.draggable = True container.show_background = True container.width = 300 container.height = 500 toggle = Toggle(TextModel(font, 'Sound', 24)) toggle.active_image = chk_view toggle.inactive_image = x_view toggle.x = 30
scene_1.y = inner_scene.y scene_2.y = scene_1.y + scene_1.height + 15 inner_scene.add_child(Button(TextModel(font, 'Scene One', 18))) inner_scene2.add_child(Button(TextModel(font, 'Scene Two', 18))) menu2.add_child(inner_scene) menu2.add_child(scene_1) menu2.add_child(scene_2) def on_render(event, **kwargs): print event, kwargs stage = Stage() menu1 = Scene("Menu One") menu1.width = stage.width menu1.height = stage.height menu1.fill_color=(132, 134, 0) menu1.on('init', on_init) menu2 = Scene("Menu Two") menu2.width = stage.width menu2.height = stage.height menu2.fill_color=(132, 134, 127) menu2.on('init', on_init2) stage.start(menu1)