System.Threading.Thread

Here are the examples of the python api System.Threading.Thread taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

Example 1

Project: pywebview Source File: winforms.py
    def show(self):
        def start():
            self.browser = BrowserView.BrowserForm(self.title, self.url, self.width,self.height, self.resizable,
                                                   self.fullscreen, self.min_size, self.webview_ready)
            app = WinForms.Application
            app.Run(self.browser)

        thread = Thread(ThreadStart(start))
        thread.SetApartmentState(ApartmentState.STA)
        thread.Start()
        thread.Join()

Example 2

Project: ironpython3 Source File: console_util.py
    def InitializeErrorWatcher(self):
        from System.Threading import Thread, ThreadStart
        import _thread            
        self.errorLock = _thread.allocate_lock()
        self.errorString = ""
        th = Thread(ThreadStart(self.WatchErrorStream))
        th.IsBackground = True
        th.Start()

Example 3

Project: RIDE Source File: ironpython.py
    def execute(self, runnable):
        runner = Runner(runnable)
        thread = Thread(ThreadStart(runner))
        thread.IsBackground = True
        thread.Start()
        if not thread.Join(self._timeout * 1000):
            thread.Abort()
            raise TimeoutError(self._error)
        return runner.get_result()

Example 4

Project: robotframework Source File: ironpython.py
    def execute(self, runnable):
        runner = Runner(runnable)
        thread = Thread(ThreadStart(runner))
        thread.IsBackground = True
        thread.Start()
        if not thread.Join(self._timeout * 1000):
            thread.Abort()
            raise self._error
        return runner.get_result()

Example 5

Project: rps-sample-scripts Source File: rpshttpserver.py
def main():
    try:
        contexts = ContextQueue()
        eventHandler = RpsEventHandler(contexts)
        externalEvent = ExternalEvent.Create(eventHandler)
        server = RpsServer(externalEvent=externalEvent, contexts=contexts)
        serverThread = Thread(ThreadStart(server.serve_forever))
        serverThread.Start()

        def closing(s, a):
            server.stop()
            return
        __window__.FormClosing += closing

    except:
        import traceback
        traceback.print_exc()

Example 6

Project: ClockworkForDynamo Source File: Clipboard.GetFrom.py
def GetText():
    def thread_proc():
        global clipboardcontents
        clipboardcontents = System.Windows.Forms.Clipboard.GetText()
    t = Thread(ThreadStart(thread_proc))
    t.ApartmentState = System.Threading.ApartmentState.STA
    t.Start()
    t.Join()

Example 7

Project: ClockworkForDynamo Source File: Clipboard.SendTo.py
def SetText(text):
    def thread_proc():
        System.Windows.Forms.Clipboard.SetText(text)
    t = Thread(ThreadStart(thread_proc))
    t.ApartmentState = System.Threading.ApartmentState.STA
    t.Start()