[Tutor] Re: [Turor] text editor problems
wheelege
wheelege@tsn.cc
Sun, 21 Jan 2001 16:49:05 +1100
This is a multi-part message in MIME format.
------=_NextPart_000_00D0_01C083CA.110BEAC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I'm pretty sure that you need to pass those variables in as arguments =
to
the function save().
Like..
def save(sname, oname)
# code
and when you call it...
save(sname, oname) # pass the variables sname and oname
I'm still a newbie so don't flame me if it doesn't turn out...
Glen.
----- Original Message -----
From: Matthias Hager <martok@mattsmail.com>
To: <tutor@python.org>
Sent: Sunday, January 21, 2001 10:45 AM
Subject: [Tutor] text editor problems
> That's what I thought(just see if those variables are there), I =
have(kind
of, just reworded for less space)
>
> def save():
> if sname:
> open sname and write to it
> elif oname:
> open oname and write to it
> else:
> saveas()
>
> def saveas():
> sname =3D asksaveasfile
> blah blah
>
> def open():
> oname =3D askopenfile
> blahblah
>
> Then it gives me the error: No variable named sname exists.
>
> I know you guys gotta be getting sick of me, but what am I doing =
wrong?
> I can't figure it out, and I've tried changing it to:
> if oname !=3D "":
> elif sname !=3D "":
>
> All kinds of stuff, but I'm still getting an error.
>
> Any help is appreciated
>
> Matthias
>
>
>
>
> --
> Programming isn't cool, it's awesome.
>
> %%%################?????????###################^^^
>
> martok@mattsmail.com
> http://mymymatthias.tripod.com/
>
> %%%################????????####################^^^
>
>
> --
>
>
>
> Like my email address? Get your own for FREE at http://firstname.com
> Get you@JohnsMail.com or you@AlexsMail.com or pick from 500 more!
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
------=_NextPart_000_00D0_01C083CA.110BEAC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><BR> Hi,<BR><BR> I'm pretty sure that you need to pass =
those=20
variables in as arguments to<BR>the function save().<BR><BR> =20
Like..<BR><BR>def save(sname, oname)<BR> # code<BR><BR>and when =
you call=20
it...<BR><BR>save(sname, oname) # pass the variables sname and=20
oname<BR><BR> I'm still a newbie so don't flame me if it doesn't =
turn=20
out...<BR><BR> Glen.<BR><BR>----- Original Message -----<BR>From: =
Matthias=20
Hager <<A=20
href=3D"mailto:martok@mattsmail.com">martok@mattsmail.com</A>><BR>To: =
<<A=20
href=3D"mailto:tutor@python.org">tutor@python.org</A>><BR>Sent: =
Sunday, January=20
21, 2001 10:45 AM<BR>Subject: [Tutor] text editor =
problems<BR><BR><BR>>=20
That's what I thought(just see if those variables are there), I =
have(kind<BR>of,=20
just reworded for less space)<BR>><BR>> def =
save():<BR>> if=20
sname:<BR>> open sname and write to=20
it<BR>> elif oname:<BR>> open =
oname=20
and write to it<BR>> =
else:<BR>> =20
saveas()<BR>><BR>> def saveas():<BR>> sname =3D=20
asksaveasfile<BR>> blah blah<BR>><BR>> def=20
open():<BR>> oname =3D askopenfile<BR>> =20
blahblah<BR>><BR>> Then it gives me the error: No variable named =
sname=20
exists.<BR>><BR>> I know you guys gotta be getting sick of me, but =
what am=20
I doing wrong?<BR>> I can't figure it out, and I've tried changing it =
to:<BR>> if oname !=3D "":<BR>> elif sname !=3D =
"":<BR>><BR>> All kinds=20
of stuff, but I'm still getting an error.<BR>><BR>> Any help is=20
appreciated<BR>><BR>> =
Matthias<BR>><BR>><BR>><BR>><BR>>=20
--<BR>> Programming isn't cool, it's awesome.<BR>><BR>>=20
%%%################?????????###################^^^<BR>><BR>> &=
nbsp; =20
<A=20
href=3D"mailto:martok@mattsmail.com">martok@mattsmail.com</A><BR>>&nbs=
p; =20
<A=20
href=3D"http://mymymatthias.tripod.com/">http://mymymatthias.tripod.com/<=
/A><BR>><BR>>=20
%%%################????????####################^^^<BR>><BR>><BR>>=
;=20
--<BR>><BR>><BR>><BR>> Like my email address? Get your own =
for FREE=20
at <A href=3D"http://firstname.com">http://firstname.com</A><BR>> Get =
<A=20
href=3D"mailto:you@JohnsMail.com">you@JohnsMail.com</A> or <A=20
href=3D"mailto:you@AlexsMail.com">you@AlexsMail.com</A> or pick from 500 =
more!<BR>><BR>><BR>>=20
_______________________________________________<BR>> Tutor =
maillist =20
- <A href=3D"mailto:Tutor@python.org">Tutor@python.org</A><BR>> =
<A=20
href=3D"http://mail.python.org/mailman/listinfo/tutor">http://mail.python=
.org/mailman/listinfo/tutor</A><BR></DIV></BODY></HTML>
------=_NextPart_000_00D0_01C083CA.110BEAC0--