#! /usr/bin/python import clutter from gtk import gdk stage = clutter.stage_get_default() stage.set_color(clutter.color_parse('Black')) stage.set_size(800, 600) stage.set_title('Cluttershow') stage.connect('key-press-event', clutter.main_quit) timeline = clutter.Timeline(15, 30) # 15 frames at 30fps behaviour = clutter.BehaviourOpacity(clutter.Alpha(timeline, clutter.sine_inc_func), 0x00, 0xFF) def completed(timeline): global current_tex, next_tex, behaviour behaviour.remove_all() temp = current_tex current_tex = next_tex next_tex = temp next_tex.hide() timeline.connect("completed", completed) def swap(stage, event): global timeline, behaviour # Don't swap if we're already swapping if timeline.is_playing(): return behaviour.apply(next_tex) # Set the default state next_tex.raise_top() next_tex.set_opacity(0) next_tex.show() # Start the timeline again timeline.rewind() timeline.start() stage.connect('button-press-event', swap) pixbuf = gdk.pixbuf_new_from_file_at_size("/home/ross/Pictures/Desktop/1024x768/orange-sky.jpg", 800, 600) current_tex = clutter.texture_new_from_pixbuf(pixbuf) current_tex.set_position(0, 0) current_tex.set_size (800, 600) stage.add(current_tex) pixbuf = gdk.pixbuf_new_from_file_at_size("/home/ross/Pictures/Desktop/1024x768/rain.jpg", 800, 600) next_tex = clutter.texture_new_from_pixbuf(pixbuf) next_tex.set_position(0, 0) next_tex.set_size (800, 600) stage.add(next_tex) current_tex.show() stage.show() clutter.main()