Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25730
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'c++,': 0.07; 'python': 0.09; '(written': 0.09; 'callback': 0.09; 'called.': 0.09; 'explicitely': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thread,': 0.09; 'gui': 0.11; 'thread': 0.11; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:import': 0.16; 'thread.': 0.16; 'true:': 0.16; 'module': 0.19; 'import': 0.21; 'driven': 0.22; 'subject:problem': 0.22; "user's": 0.22; 'bruce': 0.23; 'sets': 0.23; 'this:': 0.23; 'second': 0.24; 'connected': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'fine': 0.28; 'environment': 0.29; 'cocoa': 0.29; 'invoke': 0.29; 'writes:': 0.29; 'skip:_ 10': 0.29; 'primary': 0.30; 'code': 0.31; 'mac': 0.32; 'running': 0.32; 'environment,': 0.33; 'to:addr:python-list': 0.33; 'received:org': 0.36; 'visual': 0.36; 'charset:us-ascii': 0.36; 'skip:3 10': 0.37; 'usual': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'situation': 0.62; 'more': 0.63; 'received:217': 0.68; 'box,': 0.69; 'rendering': 0.71; '100': 0.78 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dieter Maurer <dieter@handshake.de> |
| Subject | Re: A thread import problem |
| Date | Sat, 21 Jul 2012 10:32:09 +0200 |
| References | <CA+WuaScBDU_5LcrCrTtDr6N3gHCk9hQ03fA=DT359GCRY=a=KQ@mail.gmail.com> <CA+WuaSeRExxaD9yCNWhXoWqsV_ZqP8DOvdErMRdNS-H_UtzQyg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Gmane-NNTP-Posting-Host | pd9e08462.dip0.t-ipconnect.de |
| User-Agent | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) |
| Cancel-Lock | sha1:H9lCuOCWei6md73/cEn7rQihLrA= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2369.1342859551.4697.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1342859551 news.xs4all.nl 6869 [2001:888:2000:d::a6]:57005 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25730 |
Show key headers only | View raw
Bruce Sherwood <bruce.sherwood@gmail.com> writes: > ... > from visual import box, rate > b = box() > while True: > rate(100) # no more than 100 iterations per second > b.pos.x += .01 > > This works because a GUI environment is invoked by the visual module > in a secondary thread (written mainly in C++, connected to Python by > Boost). The OpenGL rendering of the box in its current position is > driven by a 30-millisecond timer. This works fine with any environment > other than Mac Cocoa. > > However, the Mac Cocoa GUI environment and interact loop are required > to be the primary thread, so the challenge is to have the visual > module set up the Cocoa environment, with the user's program running > in a secondary thread. Any ideas? The usual approach to this situation is to invoke the user code via a callback from the UI main loop or invoke it explicitely after the UI system has been set up immediately before its main loop is called. Might look somehow like this: main thread: from thread import start_new_thread from visual import setup_gui, start_main_loop setup_gui() # sets up the GUI subsystem start_new_thread(lambda: __import__(<your module>), ()) start_main_loop()
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: A thread import problem Dieter Maurer <dieter@handshake.de> - 2012-07-21 10:32 +0200
csiph-web