Use wx.callafter to correctly trigger the functions in the scope of the window