• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python app.run函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vispy.app.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: run

    def run(self, rom_path):
        # Firstly load the ROM
        self.cpu.memory.read_rom(rom_path)

        # Setup a canvas
        canvas = GameBoy.GBCanvas()

        app.run()

        while self.running:
            # Increment the PC
            if self.debug:
                print("Exec PC: " + str(hex(self.cpu.r["pc"])))

            # Firstly execute an instruction
            self.cpu.executeOpcode(self.cpu.memory.read(self.cpu.r["pc"]))

            # Sync the GPU with the CPU
            self.gpu.sync(self.cpu.last_clock_inc)

            # Get a frame if it is ready
            frame = self.gpu.get_frame()

            if frame is not None:
                # Place the frame into the current
                canvas.set_frame(frame)

            self.cpu.incPC()
开发者ID:tallsop,项目名称:pythongb,代码行数:28,代码来源:gb.py


示例2: traces

def traces(args):
    from vispy.app import run
    from phy.plot.traces import TraceView
    from phy.io.h5 import open_h5
    from phy.io.traces import read_kwd, read_dat

    path = args.file
    if path.endswith('.kwd'):
        f = open_h5(args.file)
        traces = read_kwd(f)
    elif path.endswith(('.dat', '.bin')):
        if not args.n_channels:
            raise ValueError("Please specify `--n-channels`.")
        if not args.dtype:
            raise ValueError("Please specify `--dtype`.")
        if not args.sample_rate:
            raise ValueError("Please specify `--sample-rate`.")
        n_channels = int(args.n_channels)
        dtype = np.dtype(args.dtype)
        traces = read_dat(path, dtype=dtype, n_channels=n_channels)

    start, end = map(int, args.interval.split(','))
    sample_rate = float(args.sample_rate)
    start = int(sample_rate * start)
    end = int(sample_rate * end)

    c = TraceView(keys='interactive')
    c.visual.traces = .01 * traces[start:end, ...]
    c.show()
    run()

    return None, None
开发者ID:eghbalhosseini,项目名称:phy,代码行数:32,代码来源:phy_script.py


示例3: visualise_path

def visualise_path(path):
    canvas = scene.SceneCanvas(show=True, keys='interactive')
    grid = canvas.central_widget.add_grid()
    
    vb = grid.add_view(name='vb')
    vb.parent = canvas.scene
    vb.clip_method='viewport'
    vb.camera = scene.TurntableCamera(elevation=30, azimuth=30, up='+z')

    a = []
    col = True
    for i in range(len(path)):
        if i == 0:
            a += [(0.0, 0.0, 1.0, 1.0)]
        elif col:
            a += [(1.0, 0.0, 0.0, 1.0)]
        else:
            a += [(0.0, 1.0, 0.0, 1.0)]
        col = not col
    line1 = scene.visuals.Line(pos = path.copy(),
                               method = 'gl',
                               antialias=True,
                               name='line1',
                               color=a,
                               parent=vb.scene,
                               connect='strip')

    ax = scene.visuals.XYZAxis(name='test', parent=vb)
    app.run()
开发者ID:ElliotJH,项目名称:clew-visualiser,代码行数:29,代码来源:scene.py


示例4: tetplot

def tetplot(points, simplices, vertex_color=None,
            edge_color=None, alpha=1.0, axis=True):
    """ main function for tetplot """
    TetPlot = scene.visuals.create_visual_node(TetPlotVisual)

    # convert data types for OpenGL
    pts_float32 = points.astype(np.float32)
    sim_uint32 = simplices.astype(np.uint32)

    # The real-things : plot using scene
    # build canvas
    canvas = scene.SceneCanvas(keys='interactive', show=True)

    # Add a ViewBox to let the user zoom/rotate
    view = canvas.central_widget.add_view()
    view.camera = 'turntable'
    view.camera.fov = 50
    view.camera.distance = 5

    # toggle drawing mode
    TetPlot(pts_float32, sim_uint32, vertex_color,
            color=None, alpha=alpha, mode='triangles', parent=view.scene)
    if edge_color is not None:
        TetPlot(pts_float32, sim_uint32, vertex_color,
                color=edge_color, alpha=alpha, mode='lines',
                parent=view.scene)

    # show axis
    if axis:
        scene.visuals.XYZAxis(parent=view.scene)

    # run
    if sys.flags.interactive != 1:
        app.run()
开发者ID:cawasthi,项目名称:vispy-tutorial,代码行数:34,代码来源:tetplot.py


示例5: show

    def show(self):
        if self._points is None:
            raise ValueError("Points is empty, please call imgToPoints() first.")

        # centralize
        self.centralize()
        # colors
        colors = np.array(np.abs(self._points[:,:3]),dtype=np.float32)
        mx = np.max(colors[:,0])
        my = np.max(colors[:,1])
        mz = np.max(colors[:,2])

        brighter = 0.05
        colors[:,0]/=mx+brighter
        colors[:,1]/=my+brighter
        colors[:,2]/=mz+brighter

        alpha = np.empty((len(colors[:,0]),1))
        alpha.fill(0.8)
        colors = np.hstack([colors,alpha])
        # sizes
        sizes = self.histogramEqualize()

        # visualize
        c = Canvas(self._points[:,:3],colors,sizes)
        app.run()
开发者ID:alee156,项目名称:clarityexplorer,代码行数:26,代码来源:__init__.py


示例6: main

def main(argv):
    argParser = argparse.ArgumentParser()
    argParser.add_argument('-s', '--start_frame', action='store', type=int, default=0,
            help='starting frame for viewing the sequence')
    argParser.add_argument("path", action="store", type=str, 
            help="path to either .sima folder or imaging sequence")
    args = argParser.parse_args(argv)
    
    canvas = Canvas(args.path, start=args.start_frame)
    canvas.show()
    app.run()
开发者ID:sebiRolotti,项目名称:Visualization,代码行数:11,代码来源:orth_anim.py


示例7: __init__

    def __init__(self, h):
        self.h = h
        app.Canvas.__init__(self, keys='interactive', size=(800, 550))
        
        hcyl = mplcyl.TruncatedCone()
        print('1')
        #plot_tc(p0=np.array([1, 3, 2]), p1=np.array([8, 5, 9]), R=[5.0, 2.0])
        verts, edges = h.get_geometry()

        self.meshes = []
        self.rotation = MatrixTransform()
        sec_ids = []
        s = 1.0
        x, y = 0., 0.
        for edge in edges:
            ends = verts['pos'][edge]  # xyz coordinate of one end [x,y,z]
            dia = verts['dia'][edge]  # diameter at that end
            sec_id = verts['sec_index'][edge[0]]  # save the section index
            
            dif = ends[1]-ends[0]  # distance between the ends
            length = (dif**2).sum() ** 0.5
            # print length
            # print dia
            #C, T, B = hcyl.make_truncated_cone(p0=ends[0], p1=ends[1], R=[dia[0]/2., dia[1]/2.])
            mesh_verts =  create_cylinder(8, 8, radius=[dia[0]/2., dia[1]/2.], length=length, offset=False)
            #mesh_verts = create_grid_mesh(C[0], C[1], C[2])

            
            # sec_id_array = np.empty(mesh_verts.shape[0]*3, dtype=int)
            # # sec_id_array[:] = sec_id
            # meshes.append(mesh_verts)
            # sec_ids.append(sec_id_array)
            self.meshes.append(visuals.MeshVisual(meshdata=mesh_verts, color='r'))

#             transform = ChainTransform([STTransform(translate=(x, y),
#                                                     scale=(s, s, s)),
#                                         self.rotation])
#
#         for i, mesh in enumerate(self.meshes):
# #            x = 800. * (i % grid[0]) / grid[0] + 40
#             mesh.transform = transform
#             mesh.transforms.scene_transform = STTransform(scale=(1, 1, 0.01))
        
        gloo.set_viewport(0, 0, *self.physical_size)
        gloo.clear(color='white', depth=True)

        for mesh in self.meshes:
            mesh.draw()

        print('running')
        self.show()
        if sys.flags.interactive != 1:
            app.run()
开发者ID:pbmanis,项目名称:neuronvis,代码行数:53,代码来源:hoc_graphics.py


示例8: drawShadows

def drawShadows(inputFile='/Users/rachel/Downloads/cloud_frac_padded_623_812_70_4096_4096.png',
				outputFile='/Users/rachel/Downloads/newshadow.png',
				lightPosition=(20, 0, 0),
				dataShape=(623, 812, 70),
				textureShape=(4096, 4096),
				tileLayout=(6,5),
				steps=81,
				alphaScale=2):
	'''
	Given a tiled data PNG file and a light position, computes the shadows
	on the data and writes them to a second PNG.
	@param inputFile: path to the input PNG
	@type inputFile: string
	@param outputFile: path to write out the results
	@type outputFile: string
	@param lightPosition: position of the point light
	@type lightPosition: 3-tuple
	@param dataShape: 3D shape of the data field
	@type dataShape: 3-tuple
	@param textureShape: shape of the input image
	@type textureShape: 2-tuple
	@param tileLayout: (cols, rows) arrangement of tiles in the input PNG
	@type tileLayout: 2-tuple
	@param steps: how many steps to take through the data in calculations
	@type steps: int
	@param alphaScale: factor to scale the light absorption
	@type alphaScale: number
	'''
	
	width = textureShape[0]
	height = textureShape[1]

	c = app.Canvas(show=False, size=(width, height))

	cloudTex = getCloudTexture(inputFile, width, height)
	vertexPath = os.path.join(homeDir, 'shadow_vertex.glsl')
	fragmentPath = os.path.join(homeDir, 'shadow_frag.glsl')
	vertex = getShader(vertexPath)
	fragment = getShader(fragmentPath)

	program = mkProgram(vertex, fragment, cloudTex, dataShape=dataShape, textureShape=textureShape, tileLayout=tileLayout)
	setLightPosition(program, lightPosition)
	setResolution(program, steps, alphaScale)

	@c.connect
	def on_draw(event):
	    gloo.clear((1,1,1,1))
	    program.draw(gl.GL_TRIANGLE_STRIP)
	    im = gloo.util._screenshot((0, 0, c.size[0], c.size[1]))
	    imsave(outputFile, im)
	    c.close()

	app.run()
开发者ID:met-office-lab,项目名称:gpu-processing-service,代码行数:53,代码来源:shadow_generation.py


示例9: __init__

    def __init__(self, bubble_list, boundaries = np.asarray([[0, 10], [0, 10], [0, 10]])):
        self.auto = False
        self.time_step = 0.05
        self.bubbles = bubble_list
        self.bound = boundaries
        for bble in self.bubbles:
            bble.set_bound(self.bound)
        canvas = vscene.SceneCanvas(show=True, title=sys.argv[0])
        # canvas.measure_fps()
        view = canvas.central_widget.add_view()
        if self.bound is not None:
            bound_pt = np.array([[self.bound[0, 0], self.bound[1, 0], self.bound[2, 0]],
                                 [self.bound[0, 1], self.bound[1, 0], self.bound[2, 0]],
                                 [self.bound[0, 1], self.bound[1, 1], self.bound[2, 0]],
                                 [self.bound[0, 0], self.bound[1, 1], self.bound[2, 0]],
                                 [self.bound[0, 0], self.bound[1, 0], self.bound[2, 0]],
                                 [self.bound[0, 0], self.bound[1, 0], self.bound[2, 1]],
                                 [self.bound[0, 1], self.bound[1, 0], self.bound[2, 1]],
                                 [self.bound[0, 1], self.bound[1, 1], self.bound[2, 1]],
                                 [self.bound[0, 0], self.bound[1, 1], self.bound[2, 1]],
                                 [self.bound[0, 0], self.bound[1, 0], self.bound[2, 1]]],
                                 dtype=np.float32)
            bound_vi = vscene.visuals.Line(pos=bound_pt, color=(1.00, 1.00, 1.00, 0.25))
            view.add(bound_vi)
        view.camera = 'turntable'
        for bble in self.bubbles:
            bble.init_visual(view)

        def update(ev):
            for bble in self.bubbles:
                bble.step(self.time_step)

        timer = vapp.Timer()
        timer.connect(update)

        @canvas.events.key_press.connect
        def on_key_press(event):
            if event.key == 'Right':
                for bble in self.bubbles:
                    bble.step(self.time_step)
            if event.key == 'Space':
                if self.auto:
                    timer.stop()
                    self.auto = False
                else:
                    timer.start(self.time_step)
                    self.auto = True
            if event.key == 's':
                for bble in self.bubbles:
                    bble.shake()

        vapp.run()
开发者ID:ochoadavid,项目名称:SciPyLA2016-VisPy,代码行数:52,代码来源:bworld.py


示例10: tetplot

def tetplot(points, simplices):
    """ main function for tetplot """
    colors = np.random.rand(points.shape[0], 4)
    colors[:, -1] = 1.0
    colors = colors.astype(np.float32)

    # extract triangles and edges
    triangles = sim2tri(simplices)
    edges = sim2edge(simplices)

    # plot
    Canvas(points, colors, triangles, edges)
    app.run()
开发者ID:cawasthi,项目名称:vispy-tutorial,代码行数:13,代码来源:tetplot-gloo.py


示例11: tetplot

def tetplot(points, simplices, vertex_color=None,
            edge_color=None, alpha=1.0, axis=True):
    """ main function for tetplot """
    TetPlot = scene.visuals.create_visual_node(TetPlotVisual)

    # convert data types for OpenGL
    pts_float32 = points.astype(np.float32)
    sim_uint32 = simplices.astype(np.uint32)

    # The real-things : plot using scene
    # build canvas
    canvas = scene.SceneCanvas(keys='interactive', show=True)

    # Add a ViewBox to let the user zoom/rotate
    view = canvas.central_widget.add_view()
    view.camera = 'turntable'
    view.camera.fov = 50
    view.camera.distance = 3

    if vertex_color is not None and vertex_color.ndim == 1:
        vertex_color = blue_red_colormap(vertex_color)

    # drawing only triangles
    # 1. turn off mask_color, default = [1.0, 1.0, 1.0, alpha]
    # 2. mode = 'triangles'
    TetPlot(pts_float32, sim_uint32, vertex_color,
            mask_color=None, alpha=alpha, mode='triangles',
            parent=view.scene)

    # drawing only lines
    # 1. turn off vertex_color, default = [[1.0, 1.0, 1.0, 1.0]*N]
    # 2. mode = 'lines'
    # 3. alpha channel is specified instead of mask_color
    if edge_color is not None:
        TetPlot(pts_float32, sim_uint32, vertex_color=None,
                mask_color=edge_color, alpha=alpha, mode='lines',
                parent=view.scene)

    # show axis
    if axis:
        scene.visuals.XYZAxis(parent=view.scene)

    # run
    app.run()
开发者ID:liubenyuan,项目名称:pyEIT,代码行数:44,代码来源:tetplot.py


示例12: plot

    def plot(self):

        from vispy import app, scene, io

        # Prepare canvas
        canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)
        canvas.measure_fps()

        # Set up a viewbox to display the image with interactive pan/zoom
        view = canvas.central_widget.add_view()

        for a in self.actors:
            a.init_visual(scene, view.scene)

        fov = 60.
        cam1 = scene.cameras.FlyCamera(parent=view.scene, fov=fov, name='Fly')
        view.camera = cam1

        # def on_resize(self, event):
        #     176  # setup the new viewport
        #     gloo.set_viewport(0, 0, *event.physical_size)
        #     w, h = event.size
        #     self.projection = perspective(45.0, w / float(h), 1.0, 1000.0)
        #     self.program['u_projection'] = self.projection

        dt = 0.002
        def update(event):
            # update the simulation
            for i in range(1):
                self.integrate(dt)
            # upload new state to gpu
            for i in range(len(self.actors)):
                actor = self.actors[i]
                if isinstance(actor, MeshActor):
                    if not isinstance(actor, StaticActor):
                        actor.visual.set_data(vertices=actor.position[actor.mesh.faces])
                if isinstance(actor, ParticleActor):
                    actor.visual.set_data(actor.position)

        timer = app.Timer(interval=dt, connect=update)

        timer.start()
        app.run()
开发者ID:EelcoHoogendoorn,项目名称:collision,代码行数:43,代码来源:simulation.py


示例13: plot

def plot(mesh, show_k=False, show_v=False, show_f=False):
    points = mesh.points
    springs = mesh.springs

    canvas = scene.SceneCanvas(keys='interactive', show=True)
    view = canvas.central_widget.add_view()
    view.camera = 'panzoom'
    view.camera.aspect = 1
    edges = springs[['p0', 'p1']].view(('i8', 2))
    lines = scene.Line(
        pos=points, connect=edges,
        antialias=False,
        method='gl', color='green', parent=view.scene)
    markers = scene.Markers(
        pos=points, face_color='blue', symbol='o', parent=view.scene,
        size=0.5, scaling=True
        )

    view.camera.set_range()

    app.run()
开发者ID:RussTorres,项目名称:pyspringmesh,代码行数:21,代码来源:vp.py


示例14: procShadows

def procShadows(dataArray,
                dataShape=(623, 812, 70),
                lightPosition=(20, 0, 0),
                steps=81,
                alphaScale=2,
                ambience=0.3):
    '''
    Given a tiled data PNG file and a light position, computes the shadows
    on the data and writes them to a second PNG.

    Args:
        * dataArray (array): data for which to calculate shadows
        * dataShape (3-tuple): 3D shape of the data field
        * lightPosition (3-tuple): position of the point light
        * steps (int): how many steps to take through the data in calculations
        * alphaScale (int): factor to scale the light absorption
        
    '''

    dataTexture = makeTexture(dataArray)
    textureShape = dataArray.shape[:2]
    tileLayout = (int(textureShape[0]/dataShape[0]),
                  int(textureShape[1]/dataShape[1]))
    vertex = getShader(os.path.join(homeDir, 'shadow_vertex.glsl'))
    fragment = getShader(os.path.join(homeDir, 'shadow_frag.glsl'))

    program = makeProgram(vertex, fragment, dataTexture,
                        dataShape=dataShape, 
                        textureShape=textureShape,
                        tileLayout=tileLayout)
    setLightPosition(program, lightPosition)
    setResolution(program, steps, alphaScale)
    setAmbientLight(program, ambience)

    c = Canvas(size=textureShape, program=program)
    app.run()

    render = c.shadowsArray[:, :, :3]

    return render
开发者ID:AlexHilson,项目名称:image-service,代码行数:40,代码来源:shadowproc.py


示例15: run

def run(
        mesh, show_k=False, show_v=False, show_f=False,
        run=None, verbose=False):
    points = mesh.points
    springs = mesh.springs

    canvas = scene.SceneCanvas(keys='interactive', show=True)
    view = canvas.central_widget.add_view()
    view.camera = 'panzoom'
    view.camera.aspect = 1
    edges = springs[['p0', 'p1']].view(('i8', 2))
    lines = scene.Line(
        pos=points, connect=edges,
        antialias=False,
        method='gl', color='green', parent=view.scene)
    markers = scene.Markers(
        pos=points, face_color='blue', symbol='o', parent=view.scene,
        size=0.5, scaling=True
        )

    view.camera.set_range()

    def update(ev):
        t0 = time.time()
        run(mesh)
        t1 = time.time()
        if verbose:
            print("run: %s" % (t1 - t0, ))
        if mesh.points.min() == numpy.nan or mesh.points.max() == numpy.nan:
            return False
        t0 = time.time()
        markers.set_data(pos=mesh.points, size=0.5, scaling=True)
        lines.set_data(pos=mesh.points)
        t1 = time.time()
        if verbose:
            print("set_data: %s" % (t1 - t0, ))

    if run is not None:
        timer = app.Timer(interval=0, connect=update, start=True)
    app.run()
开发者ID:RussTorres,项目名称:pyspringmesh,代码行数:40,代码来源:vp.py


示例16: main

def main():
    graph, osm = read_osm(sys.argv[1])
    print(osm.bounds)

    if len(sys.argv) > 2:
        if sys.argv[2] == 'renderer':
            path, _ = shortest_path.dijkstra(graph, '1081079917', '65501510')
            points = get_points_from_node_ids(osm, path)
            minX = float(osm.bounds['minlon'])
            maxX = float(osm.bounds['maxlon'])
            minY = float(osm.bounds['minlat'])
            maxY = float(osm.bounds['maxlat'])

            road_vbos, other_vbos = get_vbo(osm)

            c = Canvas(road_vbos, other_vbos, [minX, minY, maxX, maxY], scale=100)
            # c.measure_fps()
            # c = Canvas([([[0.0, 0.0, 0.0],[0.5, 0.5, 0.0],[2.0,0.0,0.0],[0.0,0.0,0.0]], (0.0, 0.0, 0.0))], [-1.0, -1.0, 1.0, 1.0], scale=1)
            app.run()
    else:
        # path, _ = shortest_path.bidirectional_dijkstra(graph, '1081079917', '65501510')
        matplotmap = MatplotLibMap(osm, graph)
开发者ID:ssarangi,项目名称:osmpy,代码行数:22,代码来源:osm_to_networkx.py


示例17: run

    def run(self):
        count = 0
        if 'camera' in self.model['input'] : #or  'opencv' in self.model['input'] :
            start = time.time()
            if self.camera.rpi : #'picamera' in self.model['input'] :
                stream = io.BytesIO()
                for foo in self.camera.cap.capture_continuous(stream, 'bgr', use_video_port=True):
                    self.code(stream, connection)
                    # If we've been capturing for more than 30 seconds, quit
                    if message == b'RIP':
                        finish = time.time()
                        break
                    # Reset the stream for the next capture
                    stream.seek(0)
                    stream.truncate()
                    count += 1
                # Write a length of zero to the stream to signal we're done
                connection.write(struct.pack('<L', 0))
            else: #if 'opencv' in self.model['input'] :
                while True:
                    # Wait for next request from client
                    message = self.socket.recv()
                    if self.verb: print("Received request %s" % message)
                    if message == b'RIP':
                        finish = time.time()
                        break
                    # grab a frame
                    returned, cam_data = self.camera.cap.read()
                    data = self.code(cam_data.reshape((self.h, self.w, 3)))
                    # stream it
                    self.send_array(self.socket, data)
                    count += 1

        elif 'noise' in self.model['input'] :
            while True:
                # Wait for next request from client
                message = self.socket.recv()
                if self.verb: print("Received request %s" % message)
                if message == b'RIP':
                    finish = time.time()
                    break
                data = np.random.randint(0, high=255, size=(self.w, self.h, 3))
                # Reset the stream for the next capture
                self.send_array(self.socket, data)
                count += 1

        elif 'stream' in self.model['input'] :
            context = zmq.Context()
            if self.verb: print("Connecting to retina with port %s" % self.model['port'])
            self.socket = context.socket(zmq.REQ)
            self.socket.connect ("tcp://%s:%s" % (self.model['ip'], self.model['port']))

            t0 = time.time()
            start = time.time()
            try:
                if 'display' in self.model['output'] :
                    from openRetina import Canvas
                    from vispy import app
                    c = Canvas(self)
                    app.run()
                else:
                    print('headless mode')
                    while time.time()-start < self.model['T_SIM'] + self.sleep_time*2:
                        data = self.request_frame()
                        if self.verb: print('Image is ', data.shape, 'FPS=', 1./(time.time()-t0))
                        t0 = time.time()
            finally:
                if 'capture' in self.model['output'] :
                    import imageio
                    print(self.decode(self.request_frame()).mean())
                    imageio.imwrite('capture.png', np.fliplr(255*self.decode(self.request_frame())))
                self.socket.send (b"RIP")
                self.socket.close()
        # print('Sent %d images in %d seconds at %.2ffps' % (
        #         count, finish-start, count / (finish-start)))
        self.socket.close()
开发者ID:meduz,项目名称:openRetina,代码行数:76,代码来源:openRetina.py


示例18: show

 def show(self):
     # Load the first frame
     self.canvas.set_frame_data(self.load_data_by_step_id(0))
     self.canvas.show()
     app.run()
开发者ID:PennyQ,项目名称:nbhdf5,代码行数:5,代码来源:nb6_h5_viewer.py


示例19: main

def main(fname):
    mvc = MolecularViewerCanvas(fname)
    mvc.show()
    app.run()
开发者ID:ggoret,项目名称:codecamp-esrf-2014,代码行数:4,代码来源:molecular_viewer.py


示例20: on_resize

@c.connect
def on_resize(event):
    (width, height) = event.size
    if width > height:
        x = (width - height) / 2
        y = 0
        w = h = height
    else:
        x = 0
        y = (height - width) / 2
        w = h = width
    gloo.set_viewport(x, y, w, h)

   # gloo.set_viewport(0, 0, *event.size)


@c.connect
def on_draw(event):
    gloo.clear((1, 1, 1, 1))
    program.draw(gl.GL_TRIANGLES)


clock = 0

# t = app.Timer(connect=tick, start=True, interval=(1/60), iterations=-1)


c.show()
app.run();
开发者ID:x4dr,项目名称:GLTest,代码行数:29,代码来源:test3.5.py



注:本文中的vispy.app.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python app.use_app函数代码示例发布时间:2022-05-26
下一篇:
Python visitorUtil.visitGeneric函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap