Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Pyjs is slightly different from traditional Web development: it's more like Desktop application development. This guide should help you to get started quickly in developing your first application. You'll find references to API documentation, more tutorials and other guides in the Resources section below.
Before you continue, be sure that you have these tools installed on your machine:
python (http://www.python.org/) pip (https://pypi.python.org/pypi)
Note: If you get a "permission denied" error when using pip or setup.py, you may add the --user flag to install to a location in your home directory, which should resolve any permissions issues. Doing this, you may need to add this location to your PATH and PYTHONPATH. Alternatively, you can run this with 'sudo'.
If you want Pyjs only for your apps use it, simply do this:
pip install git+https://github.com/pyjs/pyjs.git#egg=pyjs
This will install Pjs, Pyjs-Tools and all dependencies.
Get the source from the git:
git clone https://github.com/pyjs/pyjs.git
Change into the pyjs root directory:
cd <pyjs root>
Install Pyjs, Pyjs-Tools, and all dependencies:
python setup.py install
You are now ready to use Pyjs. Once it is installed, you can import Pyjs to your python script using:
pyjscompile pyjsbuild pyjampiler
Checkout and build the
helloworld example (it is in repository folder):
cd examples/helloworld pyjsbuild hello.py
./output folder containing all files you need to move to your webspace later. Of course you can test locally, too.
For test locally, just look
/examples/helloworld/output/Hello.html in the browser.
Look at the source code:
from pyjamas import Window from pyjamas.ui import RootPanel, Button def greet(sender): Window.alert("Hello, AJAX!") class Hello: def onModuleLoad(self): b = Button("Click me", greet) RootPanel().add(b)
If you've got apache running, add this to your default site config:
Alias /examples "REPLACE THIS/pyjs/examples/" <Directory "REPLACE THIS/pyjs/examples/"> Options Indexes MultiViews FollowSymLinks +ExecCGI AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 AddHandler cgi-script .py </Directory>
and point your browser to http://localhost/examples/
Play with other examples on your local machine, use
- Look at some more examples, in the
- Look at some more examples
- Did I say 'Look at some more examples'?
- Build your own from a copy from
If you run into problems installing Pyjs (read: if you can't get the example applications running due to import errors) see the following articles:
- PyjamasAndPyjamasDesktop (Pyjs and Pyjs Desktop)
- PyjamasUbuntu (if you run Ubuntu the XULrunner/hulahop dependencies may be broken)
- InstallingPyjamasAndPyjamasDesktopForWindows (specific for Windows users)
- Pyjs API documentation (on the website)
- UI Hierarchy documentation (on the website)
- Pyjs Examples (lots of show cases!)
- UI controls showcase 1 (Showcase example)
- UI controls showcase 2 (Kitchensink example)
- Pyjs Book (bookreader application written in Pyjs)
/controls_tutorial.html- Writing Controls tutorial
/controls_tutorial02.html- Event Handling tutorial
/getting_started.html- Getting Started with Pyjs (Tutorial)