92 views
0
    <span class="n">api_master</span> <span class="o">=</span> <span class="n">TqApi</span><span class="p">(</span><span class="n">TqSim</span><span class="p">())</span>

    <span class="c1"># Create new threads</span>
    <span class="n">thread1</span> <span class="o">=</span> <span class="n">WorkerThread</span><span class="p">(</span><span class="n">api_master</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="s2">"SHFE.cu1901"</span><span class="p">)</span>
    <span class="n">thread2</span> <span class="o">=</span> <span class="n">WorkerThread</span><span class="p">(</span><span class="n">api_master</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="s2">"SHFE.rb1901"</span><span class="p">)</span>

    <span class="c1"># Start new Threads</span>
    <span class="n">thread1</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
    <span class="n">thread2</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>

    <span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
        <span class="n">api_master</span><span class="o">.</span><span class="n">wait_update</span><span class="p">()
</span>这种方式下如何在线程的数据进行可视化,主线程一直在做<span class="n">api_master</span><span class="o">.</span><span class="n">wait_update</span><span class="p">()</span>
Answered question