Exemplo n.º 1
0
def test():
    channels = (("angle", 0, 360, 0.1, 200), ("velocity", -100, 100, 0.1, 200))
    slider = SliderMulti(channels)
    sth = dummy_threading.Thread(target=slider.mainloop, args=())
    sth.start()
    #	thread.start_new_thread(slider.mainloop, ())

    while (1):
        print(slider.get())
        time.sleep(0.5)
Exemplo n.º 2
0
def test():
    channels = (("angle", 0, 360, 0.1, 200, 180),
                ("velocity", -100, 100, 0.1, 200), ("hoge", 0.1, 0.2, 0.01,
                                                    200, 0.15))
    slider = SliderMulti(channels,
                         varType="double",
                         title="hoge",
                         button=True,
                         buttonText="foobar")
    sth = dummy_threading.Thread(target=slider.mainloop, args=())
    sth.start()
    #	thread.start_new_thread(slider.mainloop, ())

    while (1):
        print(slider.get())
        time.sleep(0.5)
Exemplo n.º 3
0
 def process_request(self, request, client_address):
     """Start a new thread to process the request."""
     t = threading.Thread(target = self.process_request_thread,
                          args = (request, client_address))
     t.daemon = self.daemon_threads
     t.start()
Exemplo n.º 4
0
        time.sleep(1)
    print('thread %s ended.' % threading.current_thread().name)


# if __name__ == '__main__':
#
#     print('thread %s is running...' % threading.current_thread().name)
#     t = threading.Thread(target=loop, name='LoopThread')
#     t.start()
#     t.join()
#     print('thread %s ended.' % threading.current_thread().name)


def testa():
    time.sleep(3)
    print("a")


def testb():
    time.sleep(3)
    print("b")


ta = threading.Thread(target=testa)
tb = threading.Thread(target=testb)
for t in [ta, tb]:
    t.start()
# for t in [ta, tb]:
#     t.join()
print("DONE")
Exemplo n.º 5
0
#! usr/bin/env python
# bad  dummy_threading!!!!

import dummy_threading as threading
import time

num = 0
lock = threading.Lock()


def run():
    time.sleep(1)
    lock.acquire()
    global num
    num += 1
    lock.release()
    print('{}'.format(num))


for i in range(10):
    t = threading.Thread(target=run)
    t.start()