这是API链接码(元大期货)
我们的团队已经尝试了很多周,现在似乎是完成它的最后一步了。 你可以在我的 Github 上查阅他的全部代码、包和文件。 (https://github.com/brian09088/元大API)
当我开始在 anaconda Spyder 上运行它时,它会弹出 GUI 窗口进行登录 但是几秒钟后,它会显示没有任何反应,需要关机。 像下图这样:
class MyApp(wx.App):
def MainLoop(self, run_func):
# Create an event loop and make it active. If you are
# only going to temporarily have a nested event loop then
# you should get a reference to the old one and set it as
# the active event loop when you are done with this one...
evtloop = wx.GUIEventLoop()
old = wx.EventLoop.GetActive()
wx.EventLoop.SetActive(evtloop)
# This outer loop determines when to exit the application,
# for this example we let the main frame reset this flag
# when it closes.
while self.keepGoing:
# At this point in the outer loop you could do
# whatever you implemented your own MainLoop for. It
# should be quick and non-blocking, otherwise your GUI
# will freeze.
# call_your_code_here()
run_func ()
while not q.empty():
next_job = q.get()
DoJob (Bot, next_job)
# This inner loop will process any GUI events
# until there are no more waiting.
while evtloop.Pending():
evtloop.Dispatch()
# Send idle events to idle handlers. You may want to
# throttle this back a bit somehow so there is not too
# much CPU time spent in the idle handlers. For this
# example, I'll just snooze a little...
time.sleep(0.10)
evtloop.ProcessIdle()
wx.EventLoop.SetActive(old)
def Oninit(self):
self.keepGoing = True
return True
def run_job():
while not q.empty():
next_job = q.get()
DoJob(Bot, next_job)
if __name__ == "__main__":
app=MyApp()
frame = AppFrame(None, title='YuantaQuoteAPI Sample',size = (670,370))
frame.Show(True)
Bot = StockBot(frame.Handle)
app.MainLoop(run_job)
现在它显示属性错误:'myapp' 对象没有属性 'keepgoing'
我想知道是否缺少任何函数或包或类“Myapp()”需要继承其中的一些对象?