[Tutor] Re: [Turor] text editor problems

D-Man dsh8290@rit.edu
Sun, 21 Jan 2001 22:26:55 -0500

On Sun, Jan 21, 2001 at 04:49:05PM +1100, wheelege wrote:
|   Hi,
|   I'm pretty sure that you need to pass those variables in as arguments to
| the function save().

It all depends on where the save funciton is and where the data is
stored.  If save is a stand-alone utility function, then your gui
object should have the data and pass it to the function.  If the
function is a part of the gui object then it should be an instance
member (see classes and objects :-)) and isn't needed as an argument.

When I talk about your gui object, I mean you should write a class (I
really like OO in case you didn't guess) for the main window of the
ap.  That object will have a reference in it to the window and any
other widgets needed (like the text widget, buttons aren't needed once
their events have been connected with the handlers).  That object will
also store state like the filenames and the is_modified flag I
mentioned in my previous post.

|   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