July 30th, 2013, 10:51 AM
How to add folder of files to textbox?
I am trying to get the files in a directory (selected using wx.dirdialog) listed into an enlarged textbox. Here is the code I currently have:
def AddToList(self, path):
files = filter(os.path.isfile, os.listdir(path))
for f in files:
When using the "print f" command, I get all of the files printed as wanted, however, using the "self.textCtrl1.SetValue(f)", I only get the last file listed. The reason I am using a text box is that I want the user to be able to just observe the files in a directory and not be able to interact with them in any way.
Can someone help me out or point in the right direction?
Thank you in advance!
July 30th, 2013, 12:09 PM
Answering my own query.
Changed this line: self.textCtrl1.SetValue(f)
to this: self.textCtrl1.AppendText(f+"\n")