예제 #1
0
def test():
    sample_path = os.path.join('examples','data','sample.wav')
    alt_path = os.path.join('..','data','sample.wav')
    fname = find_resource('Chaco', sample_path, alt_path=alt_path,
        return_path=True)
    index, data = wav_to_numeric(fname)
    print data[:100]
    return index, data
예제 #2
0
파일: explorer.py 프로젝트: fspaolo/code
    type_manager.register_type_adapters(
        ContextAdapterFactory(
            adaptee_class=list, adapter_class=ListContextAdapter,
        ),

        list
    )

    # Python objects.
    type_manager.register_type_adapters(
        InstanceContextAdapterFactory(), object
    )

    # Get the path to the data directory
    data_path = os.path.join('examples','naming','data')
    full_path = find_resource('AppTools', data_path, alt_path='data',
        return_path=True)

    # Create the root context.
    root = PyFSContext(path=full_path)
    root.environment[Context.TYPE_MANAGER] = type_manager

    # Create and open the main window.
    window = Explorer(root=Binding(name='Root', obj=root))
    window.open()

    # Start the GUI event loop.
    gui.start_event_loop()

##### EOF #####################################################################
예제 #3
0
from enthought.enable.example_support import DemoFrame, demo_main
# Enthought imports
from enthought.enable.api import Component, ComponentEditor, Window
from enthought.traits.api import HasTraits, Instance
from enthought.traits.ui.api import Item, Group, View
from enthought.util.resource import find_resource
# Chaco imports
from enthought.chaco.api import SimplePlotFrame, VPlotContainer
from enthought.chaco.tools.api import RangeSelection
# Relative imports
from grid_plot_factory import create_gridded_line_plot
from zoom_overlay import ZoomOverlay
     
sample_path = os.path.join('examples','data','sample.wav')
alt_path = os.path.join('..','data','sample.wav')
fname = find_resource('Chaco', sample_path, alt_path=alt_path,
    return_path=True)
numpts = 3000
def read_music_data():
    from wav_to_numeric import wav_to_numeric
    index, data = wav_to_numeric(fname)
    return index[:numpts], data[:numpts]
def create_zoomed_plot():
    try:
        x,y = read_music_data()
    except:
        x = linspace(-10*pi, 10*pi, numpts)
        y = sin(x)
    main_plot = create_gridded_line_plot(x,y)
    zoom_plot = create_gridded_line_plot(x,y)
    outer_container = VPlotContainer(padding=30,
                                     fill_padding=True,
예제 #4
0
# Standard library imports
import os.path
import sys

# Enthought library imports
from enthought.util.resource import find_resource
from enthought.chaco.shell import imread, imshow, title, show

# Get the image file using the find_resource module
image_path = os.path.join("examples", "basic", "capitol.jpg")
alt_path = os.path.join("..", "basic", "capitol.jpg")
image_file = find_resource("Chaco", image_path, alt_path=alt_path)

# Check to see if the image was found
if image_file is None:
    print 'The image "capitol.jpg" could not be found.'
    sys.exit()

# Create the image
image = imread(image_file)

# Create the plot
imshow(image, origin="top left")

# Alternatively, you can call imshow using the path to the image file
# imshow(alt_path)

# Add a title
title("Simple Image Plot")

# This command is only necessary if running from command line
예제 #5
0
    # Python lists.
    type_manager.register_type_adapters(
        ContextAdapterFactory(
            adaptee_class=list,
            adapter_class=ListContextAdapter,
        ), list)

    # Python objects.
    type_manager.register_type_adapters(InstanceContextAdapterFactory(),
                                        object)

    # Get the path to the data directory
    data_path = os.path.join('examples', 'naming', 'data')
    full_path = find_resource('AppTools',
                              data_path,
                              alt_path='data',
                              return_path=True)

    # Create the root context.
    root = PyFSContext(path=full_path)
    root.environment[Context.TYPE_MANAGER] = type_manager

    # Create and open the main window.
    window = Explorer(root=Binding(name='Root', obj=root))
    window.open()

    # Start the GUI event loop.
    gui.start_event_loop()

##### EOF #####################################################################