File: ide-mode.rst

package info (click to toggle)
pgzero 1.2.post6%2Breally1.2.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,004 kB
  • sloc: python: 4,279; makefile: 162
file content (44 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Running Pygame Zero in IDLE and other IDEs
==========================================

.. versionadded:: 1.2

Pygame Zero is usually run using a command such as::

    pgzrun my_program.py

Certain programs, such as integrated development environments like IDLE and
Edublocks, will only run ``python``, not ``pgzrun``.

Pygame Zero includes a way of writing a full Python program that can be run
using ``python``. To do it, put ::

    import pgzrun

as the very first line of the Pygame Zero program, and put ::

    pgzrun.go()

as the very last line.


Example
-------

Here is a Pygame Zero program that draws a circle. You can run this by pasting
it into IDLE::


    import pgzrun


    WIDTH = 800
    HEIGHT = 600

    def draw():
        screen.clear()
        screen.draw.circle((400, 300), 30, 'white')


    pgzrun.go()