Last active
June 1, 2018 05:27
-
-
Save sirk390/e986a8d2c3ccdef46e0bdf086b892b1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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