import os import time import threading import tushare as ts from Tkinter import * from multiprocessing import Process #name="ss" def func(): print 'exit' os._exit(0) print 'func2' def creatfram(name): root = Tk() w = Label(root, text=name) w.pack() root.mainloop() print 'creatfram' def doubler(number): """ A doubling function that can be used by a process """ df = ts.get_realtime_quotes('603999') # Single stock symbol print df[['code', 'name', 'price', 'time']] name = (df['name']) + (df['price']) print name if float(df['price']) > 5: timer = threading.Timer(5, func) timer.start() creatfram(name) result = number * 2 proc = os.getpid() print('{0} doubled to {1} by process id: {2}'.format( number, result, proc)) if __name__ == '__main__': numbers = [5, 10, 15, 20, 25] procs = [] while True: #time.sleep(1) for index, number in enumerate(numbers): proc = Process(target=doubler, args=(number,)) procs.append(proc) proc.start() for proc in procs: proc.join()
Python 获取股票数据 弹出框 自动关闭 测试代码
最新推荐文章于 2021-02-09 19:10:19 发布