[Tutor] Newbie!! many questions

Kalle Svensson kalle@gnupung.net
Tue, 30 Jan 2001 20:59:07 +0100

Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Sez AquaRock7@aol.com:
> !).  There is a way to define and call functions in Python, but is there =
> way to define and call a subroutine?  Or a way to jump to another line of=
> code? i.e.:

Ummm...  You lost me there.  What's the difference?

> 2).  sys.stdout and sys.stdin
>        what are they!?  ok, sys.stdout is where the print statement goes.=
> so how can I use that to my advantage?  How can I manip[ulate this to my=
> advantage?

Note that sys.stdin, sys.stdout and sys.stderr are file objects.  Thus, it's
easier to change where your output goes.

msg =3D "Hello, file world!"
fname =3D raw_input("Where should I print the message? ")
if fname in ["", "-", "stdout"]:

> 3).  Is there a graphics library for Python?  To go along with the thread=
> about making games in Python... Not games that use OS-like grpahics, like=
> Tk... Like commercial games with grpahics lilke that.  Like so you can pl=
ot a=20
> pixel on the screen at coordinate x,y, color=3Dred.  Microsoft QBasic did=
> (my first programming language(i know its obsolete, but its great for=20
> beginners)).  Or locate text anywhere besides the next line down.  Maybe=
> there is a way to use DirectX with python?

Check out pygame (http://pygame.seul.org/).

> 4).  making executables... so I can run it without Python installed!  How=
? =20
> Someone posted about Freeze... I never heard of that, would someone care =
> explain?  Is that what I am looking for?

There are a couple of ways.  None is really nice, but if you really want to,
it's possible.  IIRC, there should be some kind of link on the pygame site.
I always force my friends to install python... <wink>

Email: kalle@gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org