2 thread, first to open chat window, second to make the phone

import threading
import time
import subprocess
import Tkinter as tk

def call_phone(name):
phone = Espace_info(name)
time.sleep(2)
subprocess.Popen('calc tel:%s' % phone)

def send_msg(name):
subprocess.Popen('notepad.exe im:%s' % name)

def thread_it(func, name):
t = threading.Thread(target=func,args=name)
t.start()
t.join(0.5)

def transfer():
name = e2.get()
thread_it(pass2, name)
thread_it(foo, name)

def judge():
if only_incident:
e1.set(jobNumber)
e2.set(msg)
transfer()
elif jobNumber and msg:
transfer()

root = tk.Tk()
e1 = tk.Entry(root)
e1.pack()
b1 = tk.Button(root, text='click', command=judge).pack()
root.mainloop()

原文地址:https://www.cnblogs.com/otfsenter/p/6339317.html