I am using python 2.7 and wxPython 2.8. I created a simple desktop application from which the user can start an HTTPServer created from the one builtin in python itself. Server is created in this way:
class Services(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
http_server = BaseHTTPServer.HTTPServer(('', 9020)), RESTRequestHandler)
http_server.serve_forever()
in another piece of code I am using wxPrinting facilities to send HTML to printer so I am trying to reuse the same code in a rest api by doing the following (I am simplyfing):
def save(handler):
manager = Manager('Samuel')
wx.CallAfter(manager.do_print) #do_print is a method already used in another part of UI code and it is working)
if I don't use wx.CallAfter I got the error "only the main thread can process Windows messages".
But in this way the code seems working only in older windows system like Windows XP meanwhile in Windows 10 nothing happens.
HTTPServer has been created starting from
https://gist.github.com/tliron/8e9757180506f25e46d9
printcalls to check ifsaveanddo_printare called.