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
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
>
> 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
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.
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
>
> 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
>
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
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