Skip to content

Commit

Permalink
Support for python threads
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosct committed Sep 14, 2015
1 parent d19ec37 commit b214159
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 9 deletions.
18 changes: 17 additions & 1 deletion example_ScriptTester/bin/data/mytest.py
Expand Up @@ -4,6 +4,9 @@

print "-"*30

from threading import Thread
from time import sleep

class myApp(object):
def __init__(self):
self.x = 50.0
Expand Down Expand Up @@ -44,4 +47,17 @@ def keyReleased(self, key):
pass

def windowResized(self, width, height):
pass
pass


#Testing threading capabilities

def athread():
n = 0
while True:
print n
n += 1
sleep(1)

t = Thread(target=athread)
t.start()
8 changes: 4 additions & 4 deletions example_ScriptTester/src/ofApp.cpp
Expand Up @@ -3,10 +3,10 @@
//--------------------------------------------------------------
void ofApp::setup(){
python.init();
python.executeScript("mytest.py");
ofxPythonObject klass = python.getObject("myApp");
if(klass)
script = klass();
python.executeScript("mytest.py");
ofxPythonObject klass = python.getObject("myApp");
if(klass)
script = klass();
}

//--------------------------------------------------------------
Expand Down

0 comments on commit b214159

Please sign in to comment.