def start(): # setup very basic window app = wx.App(0) frame = wx.Frame( None, wx.ID_ANY, 'FloatCanvas2 demo', size = (800, 600) ) canvas = NavCanvas( frame, backgroundColor = 'white' ) frame.Show() settings = [ ( 5, (5, 5), (5, 5) ), ( 1, (5, 5), (5, 5) ), ( 5, (20, 20), (5, 5) ), ( 20, (20, 20), (5, 5) ), ( 5, (5, 5), (10, 10) ), ( 1, (5, 5), (10, 10) ), ( 5, (20, 20), (10, 10) ), ] for i, setting in enumerate( settings ): sigma, kernel_size, offset = setting x = i * 200 # create the filters blurFilter = fc.GaussianBlurFilter( sigma = sigma, kernel_size = kernel_size, surface_size = (100, 100) ) shadowFilter = fc.ShadowFilter( sigma = sigma, kernel_size = kernel_size, offset = offset, shadow_colour = (0,0,0,128), surface_size = (100, 100) ) greenShadowFilter = fc.ShadowFilter( sigma = sigma, kernel_size = kernel_size, offset = offset, shadow_colour = (0,128,255,128), surface_size = (100, 100) ) glowFilter = fc.GlowFilter( sigma = 100, kernel_size = (10, 10), glow_colour = (255,255,0,128), scale = (1.3, 1.3), surface_size = (100, 100) ) threeDFilter = fc.ThreeDFilter( sigma = 100, kernel_size = (10, 10), offset = (-3,-3), scale = (0.95, 0.95), surface_size = (100, 100), shadow_colour = (0,0,0,128) ) pixelizeFilter = fc.PixelizeFilter( block_size = (5, 5), surface_size = (100, 100) ) radialLook = fc.RadialGradientLook( 'red', (0,0), 'red', (0,0), 100, 'yellow' ) blue_red = fc.SolidColourLook( line_colour = 'blue', fill_colour = 'red' ) r1 = canvas.create( 'Rectangle', (100, 100), name = 'r1', pos = (x, 0), look = blue_red, filter = blurFilter ) rr1 = canvas.create( 'RoundedRectangle', (100, 100), 30, name = 'rr1', pos = (x, 150), look = blue_red, filter = shadowFilter ) e1 = canvas.create( 'Ellipse', (100, 70), name = 'e1', pos = (x, 300), look = ( 'black', 'black' ), filter = greenShadowFilter ) c1 = canvas.create( 'Circle', 50, name = 'c1', pos = (x, 450), look = radialLook, filter = glowFilter ) rr2 = canvas.create( 'RoundedRectangle', (100, 100), 30, name = 'rr2', pos = (x, 600), look = (None, 'red'), filter = threeDFilter ) t1 = canvas.create( 'Polygon', [ (-50,50), (50, 50), (0, -50) ], name = 't1', pos = (x, 750), rotation = 45, look = blue_red, filter = pixelizeFilter ) canvas.zoomToExtents( padding_percent = 0.1 ) app.MainLoop()
def start(): # setup very basic window app = wx.App(0) frame = wx.Frame( None, wx.ID_ANY, 'FloatCanvas2 demo', size = (800, 600) ) canvas = NavCanvas( frame, backgroundColor = 'white' ) frame.Show() #canvas.dirty = False r1 = canvas.create( 'Rectangle', (100, 200), name = 'r1', pos = (0, 0), look = fc.SolidColourLook( line_colour = 'blue', fill_colour = 'red' ) ) r2 = canvas.create( 'Rectangle', (200, 100), name = 'r2', pos = (100, 100), rotation = 20, look = fc.SolidColourLook( line_colour = 'blue', fill_colour = 'red' ) ) c1 = canvas.create( 'Circle', 100, name = 'c1', pos = (200, 200), rotation = 20, look = fc.SolidColourLook( line_colour = 'blue', fill_colour = 'red', line_width = 50 ) ) c2 = canvas.create( 'Circle', 10, name = 'c2', pos = (500, 200), rotation = 20, look = fc.SolidColourLook( line_colour = 'blue', fill_colour = 'red', line_width = 2 ) ) # the default cam, looking at 500, 500 canvas.camera.position = (100, 73) #canvas.camera.rotation = 12 canvas.camera.zoom = (0.5, 0.8) nodes = [ r1, r2, c1, c2, canvas ] events = [ 'left_down', 'left_dclick', 'left_up', 'middle_down', 'middle_dclick', 'middle_up', 'right_down', 'right_dclick', 'right_up', 'wheel', 'key_down', 'key_up', ] # bind all events for node in nodes: for event in events: node.subscribe( onEvent, event ) # bind the motion event only to the mini circle so the event output doesn't # litter everything c2.subscribe( onEvent, 'move' ) app.MainLoop()
def start(): # setup very basic window app = wx.App(0) frame = wx.Frame(None, wx.ID_ANY, 'FloatCanvas2 demo', size=(800, 600)) canvas = NavCanvas(frame, backgroundColor='white') frame.Show() #canvas.dirty = False r1 = canvas.create('Rectangle', (100, 200), name='r1', pos=(0, 0), look=fc.SolidColourLook(line_colour='blue', fill_colour='red')) r2 = canvas.create('Rectangle', (200, 100), name='r2', pos=(100, 100), rotation=20, look=fc.SolidColourLook(line_colour='blue', fill_colour='red')) c1 = canvas.create('Circle', 100, name='c1', pos=(200, 200), rotation=20, look=fc.SolidColourLook(line_colour='blue', fill_colour='red', line_width=50)) c2 = canvas.create('Circle', 10, name='c2', pos=(500, 200), rotation=20, look=fc.SolidColourLook(line_colour='blue', fill_colour='red', line_width=2)) # the default cam, looking at 500, 500 canvas.camera.position = (100, 73) #canvas.camera.rotation = 12 canvas.camera.zoom = (0.5, 0.8) nodes = [r1, r2, c1, c2, canvas] events = [ 'left_down', 'left_dclick', 'left_up', 'middle_down', 'middle_dclick', 'middle_up', 'right_down', 'right_dclick', 'right_up', 'wheel', 'key_down', 'key_up', ] # bind all events for node in nodes: for event in events: node.subscribe(onEvent, event) # bind the motion event only to the mini circle so the event output doesn't # litter everything c2.subscribe(onEvent, 'move') app.MainLoop()
def start(): # setup very basic window app = wx.App(0) frame = wx.Frame(None, wx.ID_ANY, 'FloatCanvas2 demo', size=(800, 600)) canvas = NavCanvas(frame, backgroundColor='white') frame.Show() settings = [ (5, (5, 5), (5, 5)), (1, (5, 5), (5, 5)), (5, (20, 20), (5, 5)), (20, (20, 20), (5, 5)), (5, (5, 5), (10, 10)), (1, (5, 5), (10, 10)), (5, (20, 20), (10, 10)), ] for i, setting in enumerate(settings): sigma, kernel_size, offset = setting x = i * 200 # create the filters blurFilter = fc.GaussianBlurFilter(sigma=sigma, kernel_size=kernel_size, surface_size=(100, 100)) shadowFilter = fc.ShadowFilter(sigma=sigma, kernel_size=kernel_size, offset=offset, shadow_colour=(0, 0, 0, 128), surface_size=(100, 100)) greenShadowFilter = fc.ShadowFilter(sigma=sigma, kernel_size=kernel_size, offset=offset, shadow_colour=(0, 128, 255, 128), surface_size=(100, 100)) glowFilter = fc.GlowFilter(sigma=100, kernel_size=(10, 10), glow_colour=(255, 255, 0, 128), scale=(1.3, 1.3), surface_size=(100, 100)) threeDFilter = fc.ThreeDFilter(sigma=100, kernel_size=(10, 10), offset=(-3, -3), scale=(0.95, 0.95), surface_size=(100, 100), shadow_colour=(0, 0, 0, 128)) pixelizeFilter = fc.PixelizeFilter(block_size=(5, 5), surface_size=(100, 100)) radialLook = fc.RadialGradientLook('red', (0, 0), 'red', (0, 0), 100, 'yellow') blue_red = fc.SolidColourLook(line_colour='blue', fill_colour='red') r1 = canvas.create('Rectangle', (100, 100), name='r1', pos=(x, 0), look=blue_red, filter=blurFilter) rr1 = canvas.create('RoundedRectangle', (100, 100), 30, name='rr1', pos=(x, 150), look=blue_red, filter=shadowFilter) e1 = canvas.create('Ellipse', (100, 70), name='e1', pos=(x, 300), look=('black', 'black'), filter=greenShadowFilter) c1 = canvas.create('Circle', 50, name='c1', pos=(x, 450), look=radialLook, filter=glowFilter) rr2 = canvas.create('RoundedRectangle', (100, 100), 30, name='rr2', pos=(x, 600), look=(None, 'red'), filter=threeDFilter) t1 = canvas.create('Polygon', [(-50, 50), (50, 50), (0, -50)], name='t1', pos=(x, 750), rotation=45, look=blue_red, filter=pixelizeFilter) canvas.zoomToExtents(padding_percent=0.1) app.MainLoop()