Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Example 1: Hello World

fergalwalsh edited this page · 6 revisions

In example.py:

import pico

def hello():
    return "Hello World"

In index.html

<html>
<head>
    <title>Pico Example</title>
    <script type="text/javascript" src="/pico/client.js"></script>
    <script type="text/javascript">
        pico.load('example');
        pico.main = function() {
            var displayMessage = function(message){
               document.getElementById('message').innerHTML = message;
           }
           example.hello(displayMessage);
        }
    </script>
</head>
<body>
        <div id="message"></div>
</body>
</html>

python -m pico.server

Go to http://localhost:8800/index.html

Done!

Something went wrong with that request. Please try again.