[Tutor] More Tkinter Help Please [Dialog windows]

SA sarmstrong13@mac.com
Tue, 18 Jun 2002 16:36:49 -0500


> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3107263011_2114931
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable

On 6/18/02 2:50 PM, "SA" <sarmstrong13@mac.com> wrote:


>=20
> def doSave():
>   SaveDialog =3D Saving(top)
>   filename =3D SaveDialog.getName()
>   outfile =3D t1()
>   out =3D open(filename, 'w')
>   inf =3D open(outfile, 'r')
>   for line in inf.readlines():
>       out.write(line)
>   out.close()
>=20

Me very Dumb. Me go home now. Me sorry.

I can't believe I missed this. I figured it out. Well actually, the method
saving the text in t1 was already right before my eyes in the expyth method=
.
Now I use that and I get the following for the doSave method:

        def doSave():
            SaveDialog =3D Saving(top)
            filename =3D SaveDialog.getName()
            outfile =3D t1.get(0.0, END)
            out =3D open(filename, 'w')
            out.write(outfile)
            out.close()

I feel really stupid for missing that. Now all of the buttons work the way =
I
want them to. Below is a copy of the code for anyone who wishes to give it =
a
try. I like this in place of the command line idle which is all I really
have available for my OSX system. This allows you to write the code in the
top window and display it=B9s output in the bottom window, unless the output
is a gui(which is displayed as a gui window). For me it is cool, because I
can hammer away at different things and test them out before I click the
save button to save the code. It is a slight ripoff of a Tcl/Tk program I
came across that does the same thing for Perl scripts. I would like to
eventually come up with a final program that works on Tcl, Perl, or Python
(maybe even Ruby) depending on what is fed as the first line of code. If
anyone else has some suggestions for it please feel free, or if you have
some code to add, add it on and we can see where it goes from here. Thank
you very much Alan and Danny for all of your help and guidance.(and patienc=
e
with me). This has been a really cool learning experience and I find this
list very beneficial for my continued learning of Python.

Thanks.
SA

--B_3107263011_2114931
Content-type: text/html; charset="US-ASCII"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>Re: [Tutor] More Tkinter Help Please &nbsp;[Dialog windows]</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Verdana">On 6/18/02 2:50 PM, &quot;SA&quot; &lt;sarmstrong13@ma=
c.com&gt; wrote:<BR>
<BR>
<BR>
<FONT COLOR=3D"#0000FF">&gt; <BR>
&gt; def doSave():<BR>
&gt; &nbsp;&nbsp;SaveDialog =3D Saving(top)<BR>
&gt; &nbsp;&nbsp;filename =3D SaveDialog.getName()<BR>
&gt; &nbsp;&nbsp;outfile =3D t1()<BR>
&gt; &nbsp;&nbsp;out =3D open(filename, 'w')<BR>
&gt; &nbsp;&nbsp;inf =3D open(outfile, 'r')<BR>
&gt; &nbsp;&nbsp;for line in inf.readlines():<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.write(line)<BR>
&gt; &nbsp;&nbsp;out.close()<BR>
&gt; <BR>
</FONT><BR>
Me very Dumb. Me go home now. Me sorry.<BR>
<BR>
I can't believe I missed this. I figured it out. Well actually, the method =
saving the text in t1 was already right before my eyes in the expyth method.=
 Now I use that and I get the following for the doSave method:<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def doSave():<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sav=
eDialog =3D Saving(top)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fil=
ename =3D SaveDialog.getName()<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out=
file =3D <U>t1.get(0.0, END)<BR>
</U> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out =
=3D open(filename, 'w')<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out=
.write(outfile)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out=
.close()<BR>
<BR>
I feel really stupid for missing that. Now all of the buttons work the way =
I want them to. Below is a copy of the code for anyone who wishes to give it=
 a try. I like this in place of the command line idle which is all I really =
have available for my OSX system. This allows you to write the code in the t=
op window and display it&#8217;s output in the bottom window, unless the out=
put is a gui(which is displayed as a gui window). For me it is cool, because=
 I can hammer away at different things and test them out before I click the =
save button to save the code. It is a slight ripoff of a Tcl/Tk program I ca=
me across that does the same thing for Perl scripts. I would like to eventua=
lly come up with a final program that works on Tcl, Perl, or Python (maybe e=
ven Ruby) depending on what is fed as the first line of code. If anyone else=
 has some suggestions for it please feel free, or if you have some code to a=
dd, add it on and we can see where it goes from here. Thank you very much Al=
an and Danny for all of your help and guidance.(and patience with me). This =
has been a really cool learning experience and I find this list very benefic=
ial for my continued learning of Python.<BR>
<BR>
Thanks.<BR>
SA</FONT>
</BODY>
</HTML>


--B_3107263011_2114931--