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.

17 Examples 7

Example 1

Project: pywebview
Source File: winforms.py
View license
    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: RIDE
Source File: ironpython.py
View license
    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 3

Project: robotframework
Source File: ironpython.py
View license
    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 4

Project: rps-sample-scripts
Source File: rpshttpserver.py
View license
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 5

Project: ironpython3
Source File: console_util.py
View license
    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 6

View license
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

View license
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()

Example 8

View license
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 9

View license
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()

Example 10

View license
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 11

View license
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()

Example 12

View license
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 13

View license
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()

Example 14

View license
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 15

View license
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()

Example 16

View license
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 17

View license
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()