pub fn start(&mut self) -> PyResult<()> {
        if self.started {
            // This shouldn't be possible.
            return Err(exc::RuntimeError::new("The frame can only be started once"));
        }
        self.started = true;

        while let Some(e) = self.window.next() {
            if let Some(_) = e.render_args() {
                let gil = Python::acquire_gil();

                let mut canvas = &self.canvas;
                {
                    // Update the canvas size.
                    let py = gil.python();
                    canvas.as_mut(py).update_size(self.window.size().into());
                }

                if let Some(ref handler) = self.draw_handler {
                    // Call the draw handler.
                    let py = gil.python();
                    let args = PyTuple::new(py, &[canvas]);

                    let ret = handler.call(py, args, NoArgs);
                    if let Err(err) = ret {
                        return Err(err);
                    }
                }

                self.window.draw_2d(&e, |c, g| {
                    // Draw the canvas.
                    let py = gil.python();
                    let canvas = canvas.as_mut(py);
                    canvas.draw_canvas(&c, g)
                });
            }

            // TODO: event handling
        }

        Ok(())
    }
/// Starts the frame draw and event handlers.
/// Blocks the thread.
Starts the frame draw and event handlers.
Blocks the thread.
Starts the frame draw and event handlers . Blocks the thread .
pub fn start(&mut self) -> PyResult<()> {
        if self.started {
            // This shouldn't be possible.
            return Err(exc::RuntimeError::new("The frame can only be started once"));
        }
        self.started = true;
        while let Some(e) = self.window.next() {
            if let Some(_) = e.render_args() {
                let gil = Python::acquire_gil();
                let mut canvas = &self.canvas;
                {
                    // Update the canvas size.
                    let py = gil.python();
                    canvas.as_mut(py).update_size(self.window.size().into());
                }
                if let Some(ref handler) = self.draw_handler {
                    // Call the draw handler.
                    let py = gil.python();
                    let args = PyTuple::new(py, &[canvas]);
                    let ret = handler.call(py, args, NoArgs);
                    if let Err(err) = ret {
                        return Err(err);
                    }
                }
                self.window.draw_2d(&e, |c, g| {
                    // Draw the canvas.
                    let py = gil.python();
                    let canvas = canvas.as_mut(py);
                    canvas.draw_canvas(&c, g)
                });
            }
            // TODO: event handling
        }
        Ok(())
    }
pub fn start ( & mut self ) -> PyResult < ( ) > { if self . started { // This shouldn't be possible. return Err ( exc :: RuntimeError :: new ( " " ) ) ; } self . started = true ; while let Some ( e ) = self . window . next ( ) { if let Some ( _ ) = e . render_args ( ) { let gil = Python :: acquire_gil ( ) ; let mut canvas = & self . canvas ; { // Update the canvas size. let py = gil . python ( ) ; canvas . as_mut ( py ) . update_size ( self . window . size ( ) . into ( ) ) ; } if let Some ( ref handler ) = self . draw_handler { // Call the draw handler. let py = gil . python ( ) ; let args = PyTuple :: new ( py , & [ canvas ] ) ; let ret = handler . call ( py , args , NoArgs ) ; if let Err ( err ) = ret { return Err ( err ) ; } } self . window . draw_2d ( & e , | c , g | { // Draw the canvas. let py = gil . python ( ) ; let canvas = canvas . as_mut ( py ) ; canvas . draw_canvas ( & c , g ) } ) ; } // TODO: event handling } Ok ( ( ) ) }
Starts the frame draw and event handlers.
Starts the frame draw and event handlers .
&mut self