Re: [Tutor] Writing logfile data to a user opened file

2013-06-22 Thread Matt D
On 06/22/2013 03:47 AM, Alan Gauld wrote: > On 22/06/13 02:42, Matt D wrote: > >> if dlg.ShowModal() == wx.ID_OK: >> path = dlg.GetPath() >> mypath = os.path.basename(path) >> with open(mypath, "a") as f: >> f.writeli

Re: [Tutor] Writing logfile data to a user opened file

2013-06-22 Thread Alan Gauld
On 22/06/13 02:42, Matt D wrote: if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() mypath = os.path.basename(path) with open(mypath, "a") as f: f.writelines(self.log_array) so thats how i used what you said, "wi

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Matt D
> > You should really switch to the "with open() as f:" idiom I keep showing > you. This will automatically close the file for you. > it just occured to me to do this: def openFile(self, evt): with wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.tx

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Matt D
On 06/21/2013 04:44 PM, Prasad, Ramit wrote: > Matt D wrote: >> [Ramit P wrote:] >>> When you open a file the data should be written to that. If you want to >>> move existing data from logfile.txt into user opened file then you need >>> to read logfile.txt and then write it to the user opened file.

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Prasad, Ramit
Matt D wrote: > [Ramit P wrote:] > > When you open a file the data should be written to that. If you want to > > move existing data from logfile.txt into user opened file then you need > > to read logfile.txt and then write it to the user opened file. To make > > your life simpler, either pass in t

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Matt D
> > When you open a file the data should be written to that. If you want to > move existing data from logfile.txt into user opened file then you need > to read logfile.txt and then write it to the user opened file. To make > your life simpler, either pass in the file path or open the file save >

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Prasad, Ramit
Matt D wrote: > Hey guys! > So now my UI panel works well with this: > > # Open file button click event binded to openfile > btn = wx.Button(self, -1, "Click me") > sizer.Add(btn, pos=(7,2)) > btn.Bind(wx.EVT_BUTTON, self.openFile) > > #set the panel layout > s

[Tutor] Writing logfile data to a user opened file

2013-06-20 Thread Matt D
Hey guys! So now my UI panel works well with this: # Open file button click event binded to openfile btn = wx.Button(self, -1, "Click me") sizer.Add(btn, pos=(7,2)) btn.Bind(wx.EVT_BUTTON, self.openFile) #set the panel layout self.SetSizer