#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    4
    Rep Power
    0

    How to add folder of files to textbox?


    Hello,

    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):
    os.chdir(path)
    files = filter(os.path.isfile, os.listdir(path))
    for f in files:
    #print f
    self.textCtrl1.SetValue(f)

    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!
    Mark
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    4
    Rep Power
    0
    Hello,

    Answering my own query.

    Changed this line: self.textCtrl1.SetValue(f)

    to this: self.textCtrl1.AppendText(f+"\n")

    works now!

    Mark

IMN logo majestic logo threadwatch logo seochat tools logo