Search code examples
wxpython

runTest function in wxpython demos


Usually at the end of wxPython demos I see the following function:

def runTest(frame, nb, log):
    win = TestPanel(nb, log)
    return win

What exactly does this function do and what are the ramifications of removing it?


Solution

  • You can remove the code in the demo and run it that way to find out. Basically, it breaks the demo. The demo framework uses the runTest function to actually execute the demo. By removing it, you will receive an AttributeError and the demo will no longer run.

    Since you are running it in the demo, you can revert back to the original by clicking the Delete Modified button in the Demo Code tab and the demo will start working again.