Hello everyone. My question is how can we save the items on listctrl so everytime someone opens the application, the items previously added are there.

I'm trying to accomplish this with wx.Config, but I can't seem to find a good way to read the config so it accomplishes what I need.

So my question is how to write/read the wx.Config so everytime someone launches the app, it will appear the items previously added by the user.

Note: I know the basics of reading/writing in wx.Config but I can't seem to get this thing right.

Any help is appreciated, thanks.

I have no experience with wx.Config so i can't help you there, but there is a way you could do this without that and just using a file.

#... inside your frame/panel class

    def LoadCtrl(self):
        #Assuming listctrl is called listOne
        #and the file is fileOne

        f = open(fileOne)
        for item in fileOne:
            listOne.append(item)

    def SaveCtrl(self):
        f = open(fileOne, "w")

        #Loop through and save each item on its own line
        for itemIndex in listOne.GetItemCount():
            f.write(str(listOne.GetItemText(itemIndex) + "\n"))

That demonstrates my idea, if you want to implement that it shouldn't be too hard :)

hope that helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.