Skip to content

Instantly share code, notes, and snippets.

@sirk390
Last active June 1, 2018 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sirk390/e986a8d2c3ccdef46e0bdf086b892b1c to your computer and use it in GitHub Desktop.
Save sirk390/e986a8d2c3ccdef46e0bdf086b892b1c to your computer and use it in GitHub Desktop.
class TestFrame(wx.Frame):
def __init__(self, parent=None):
super(TestFrame, self).__init__(parent)
vbox = wx.BoxSizer(wx.VERTICAL)
button1 = wx.Button(self, label="Submit")
vbox.Add(button1, 1, wx.EXPAND|wx.ALL)
self.SetSizer(vbox)
self.Layout()
AsyncBind(button1, wx.EVT_BUTTON, self.async_callback)
async def async_callback(self, event):
print ("button clicked")
await asyncio.sleep(1)
print ("working")
await asyncio.sleep(1)
print ("completed")
app = WxAsyncApp()
frame = TestFrame()
frame.Show()
app.SetTopWindow(frame)
loop = get_event_loop()
loop.run_until_complete(app.MainLoop())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment