Using wx component without graphical interface

I have created a project that uses the GroupTree(wxTree) control and it works great.
But now, I created a python script that should run directly on the server. The functionality I need is entirely programmed in the GroupTree class (eg: using the GetChildren or the GetItemParent functions of the wxTree). What happens is that, when I use the class in the server script, the wxTree component pops up. I call the Hide function after the init, but it still pops up.
How can I achieve to use all features from my class, but without the popping up? So the wxTree is totally hidden.

I doubt that the TreeCtrl offers something for your use case that can’t be achieved using a simple Python data structure.

It’s a good pattern to implement your business code such that it can be used without GUI, just from scripts and programs. Then implement a GUI that uses this functionality.

I’m quite sure that doing it the other way round did not save you time in the implementation…

Thanks for the feedback.
My problem is probably that I did not start with business code, but started from the start with the wx integration.
I hoped avoiding having to write my own class with the same features that are already existing in the wx class.

I’m sure the required features don’t take more than 15 minutes to implement.
Do the refactoring now. The longer you wait, the more time it will cost you.

class Item(list):
    def __init__(self, parent, data=None):
        self.parent = parent
        self.data = data

tree = Item(None)
tree.append(Item(tree, "First Child"))
tree.insert(0, Item(tree, "Inserted Child"))

for item in tree:
   print(item.data)