[Tutor] Newbie!! many questions

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


--uxuisgdDHaNETlh8
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 =
a=20
> way to define and call a subroutine?  Or a way to jump to another line of=
=20
> 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.=
..=20
> so how can I use that to my advantage?  How can I manip[ulate this to my=
=20
> 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"]:
    sys.stdout.write(msg)
else:
    open(fname).write(msg)

> 3).  Is there a graphics library for Python?  To go along with the thread=
=20
> about making games in Python... Not games that use OS-like grpahics, like=
=20
> 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=
 that=20
> (my first programming language(i know its obsolete, but its great for=20
> beginners)).  Or locate text anywhere besides the next line down.  Maybe=
=20
> 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 =
to=20
> 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>

HTH,
  Kalle
--=20
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

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

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

iD8DBQE6dx0LdNeA1787sd0RAnS1AKCHV6WjY0oYNruXjl85z7JZ4zZT1gCgqIYP
9gmxn5UcoQ9AXmyIq8QwtSY=
=ZwzT
-----END PGP SIGNATURE-----

--uxuisgdDHaNETlh8--