remember the starting point of the path when arc is first (for correct closepath...
[PyX.git] / faq / general_aspects_pyx.rst
bloba66fe783a1f6cc6674ab3098f0549055df815d0e
1 ======================
2 General aspects of PyX
3 ======================
5 The name of the game
6 ====================
8 Originally, the name PyX was constructed as a combination of **P**\ ostscript,
9 i.e. the first output format supported by PyX, P\ **y**\ thon, i.e. the language
10 in which PyX is written, and Te\ **X**, i.e. the program which PyX uses for
11 typesetting purposes.  Actually, the title of this question is a tribute to TeX
12 because it is taken from the first chapter of the TeX book [#texbook]_ where
13 the origin of the name TeX and its pronunciation are explained.
15 Despite the ties between TeX and PyX, their pronunciation is quite different.
16 According to the developers of PyX, it should be pronounced as [pʏks]. Please do
17 not pronounce it as [pʏx] or [pʏç].
19 .. _where_do_I_get_PyX:
21 Where do I get the latest version of PyX?
22 =========================================
24 The current release of PyX (as well as older ones) is freely available from
25 `http://pyx.sourceforge.net <http://pyx.sourceforge.net>`_ where also a
26 subversion repository with the latest patches can be found. In addition, PyX is
27 registered on the Python Package Index at
28 `https://pypi.python.org/pypi/PyX <https://pypi.python.org/pypi/PyX>`_ and can
29 be installed by ``easy_install`` and ``pip``. However, the release files are
30 not hosted on PyPI itself and for future versions of ``pip`` you need to allow
31 external installation by ``--allow-external pyx``. Please see the
32 `pip documentation <http://www.pip-installer.org/>`_ for details.
34 Possibly older versions of PyX are also available as package for various Linux
35 distributions: see, for instance,
36 `http://packages.debian.org/testing/python-pyx <http://packages.debian.org/testing/python-pyx>`_
37 for information on the PyX package in Debian GNU/Linux or
38 `http://packages.ubuntu.com/raring/python-pyx <http://packages.ubuntu.com/raring/python-pyx>`_
39 for Ubuntu.
41 PyX has no dependencies on other Python packages.
43 How can I determine the version of PyX running on my machine?
44 =============================================================
46 Start a python session (usually by typing ``python`` at the system prompt) and
47 then type the following two commands (``>>>`` is the python prompt)
49 >>> import pyx
50 >>> pyx.__version__
52 Note that there are two underscores before and after ``version``.
54 How can I access older versions of PyX?
55 =======================================
57 There are reasons which might make it necessary to use older versions of PyX.
58 If you are using Python 2 you will need PyX version 0.12.1 or earlier (see
59 :ref:`python_requirements`). Furthermore, as at present it is not guaranteed
60 that PyX is backward compatible, it may be desirable to access an older version
61 of PyX instead of adapting older code to a more recent version of PyX. In order
62 to do that, one needs the corresponding PyX package (see
63 :ref:`where_do_I_get_PyX` if you need to download it), which should be unpacked
64 below a directory, e.g.  ``/home/xyz/Python``,  where you want to keep the
65 various PyX versions.  This will result in a subdirectory with a name like
66 ``PyX-0.13`` which contains the contents of the corresponding package. You
67 can then ask Python to first look in the appropriate directory before looking
68 for the current version of PyX by inserting the following code (appropriately
69 modified according to your needs) at the beginning of your program before
70 importing the PyX module::
72    import sys
73    sys.path.insert(0, "/home/xyz/Python/PyX-0.13")
75 Including appropriate lines even if the current version of PyX is used, might
76 turn out to be helpful when the current version has become an old version
77 (unless you have no difficulties determining the PyX version by looking at your
78 code).
80 If your operating system supports path expansion, you might use as an
81 alternative::
83    import sys, os
84    sys.path.insert(0, os.path.expanduser("~/Python/PyX-0.13"))
86 which will expand the tilde to your home directory.
88 Does PyX run under my favorite operating system?
89 ================================================
91 Yes, if you have installed Python (:ref:`what_is_python`) and TeX
92 (:ref:`what_is_tex`). Both are available for a large variety of operating
93 systems so chances are pretty good that you will get PyX to work on your
94 system.
96 .. _python_requirements:
98 Under which versions of Python will PyX run?
99 ============================================
101 Starting with version 0.13, PyX requires Python 3.2 or higher. If you still
102 need to run PyX with Python 2, you should use version 0.12.1 which is designed
103 to run with Python 2.3 up to 2.7.
105 The version of your Python interpreter can be determined by calling it with the
106 option ``-V``. Alternatively, you can simply start the interpreter and take a
107 look at the startup message. Note that there may be different versions of
108 Python installed on your system at the same time. The default Python version
109 need not be the same for all users.
111 Does PyX provide a GUI to view the produced image?
112 ==================================================
114 No, PyX itself does not provide a means to view the produced image. The result
115 of a PyX run is an EPS (= Encapsulated PostScript) file, a PS (= PostScript)
116 file or a PDF (= Portable Document Format) file, which can be viewed, printed
117 or imported into other applications.
119 There are several means of viewing PS and EPS files. A common way would be to
120 use ``ghostview`` which provides a user interface to the PostScript interpreter
121 ``ghostscript``. More information about this software, which is available for a
122 variety of platforms, can be found at `http://www.cs.wisc.edu/~ghost/
123 <http://www.cs.wisc.edu/~ghost/>`_.  If you do not own a printer which is
124 capable of printing PostScript files directly, ``ghostscript`` may also be
125 useful to translate PS and EPS files produced by PyX into something your
126 printer will understand.
128 PDF files can be viewed by means of the ``Adobe Reader ®`` available from
129 `http://www.adobe.com/products/acrobat/readstep2.html
130 <http://www.adobe.com/products/acrobat/readstep2.html>`_. On systems running
131 X11, ``xpdf`` might be an alternative. It is available from
132 `http://www.foolabs.com/xpdf/ <http://www.foolabs.com/xpdf/>`_.
134 If you want to do interactive development of a PyX graphics, you might consider
135 to use an IPython notebook (see :ref:`pyx_ipython_notebook`).
137 .. _pyx_ipython_notebook:
139 Will I be able to embed PyX graphics output into an IPython notebook?
140 =====================================================================
142 Yes, PyX canvas object and objects inheriting from the canvas class, in particular
143 graphs and text, can be embedded into an IPython notebook. Suppose you have a 
144 canvas object called ``c`` on which you have done some drawing. Then entering ``c``
145 in an IPython notebook cell and executing that cell will automatically produce
146 a PNG representation and embed it into the notebook. For more information on
147 IPython and working with its notebooks see `http://www.ipython.org/ <http://www.ipython.org/>`_.
149 I am a Gnuplot user and want to try PyX. Where can I get some help?
150 ===================================================================
152 There exists a tutorial by Titus Winters which explains how to perform standard
153 Gnuplot tasks with \PyX. The tutorial can be found at
154 `http://www.cs.ucr.edu/~titus/pyxTutorial/
155 <http://www.cs.ucr.edu/~titus/pyxTutorial/>`_.
157 Where can I get help if my question is not answered in this FAQ?
158 ================================================================
160 The PyX sources contain a reference manual which is also available online at
161 `http://pyx.sourceforge.net/manual/ <http://pyx.sourceforge.net/manual/>`_.
162 Furthermore, there exists a set of examples demonstrating various features of
163 PyX, which is available in the sources or can be browsed at
164 `http://pyx.sourceforge.net/examples.html
165 <http://pyx.sourceforge.net/examples.html>`_.  If the feature you are looking
166 for is among them, using the appropriate part of the example code or adapting
167 it for your purposes may help.
169 There is also a user discussion list about PyX which you can subscribe to at
170 `http://lists.sourceforge.net/lists/listinfo/pyx-user
171 <http://lists.sourceforge.net/lists/listinfo/pyx-user>`_.  The archive of the
172 discussion list is available at
173 `http://sourceforge.net/mailarchive/forum.php?forum_name=pyx-user
174 <http://sourceforge.net/mailarchive/forum.php?forum_name=pyx-user>`_.
176 Finally, it might be worth checking `http://pyx.sourceforge.net/pyxfaq.pdf
177 <http://pyx.sourceforge.net/pyxfaq.pdf>`_ for an updated version of this FAQ.
179 .. [#texbook] D.Knuth, *The TeX book* (Addison-Wesley, 1984)