Source

glutton / glutton_tester.py

import wx
import wx.lib.pubsub.setupkwargs
from wx.lib.pubsub import pub


class TestFrame(wx.Frame):
    def __init__(self, test_class):
        wx.Frame.__init__(self, None)
        self.canvas = test_class(self)
        self.Bind(wx.EVT_CLOSE, self.OnClose)

    def OnClose(self, event):
        pub.unsubAll()
        event.Skip()


def test(test_class, maximize=False):
    app = wx.App(False)
    app.TopWindow = f = TestFrame(test_class)
    f.Maximize(maximize)
    f.Show()
    app.MainLoop()