Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'python': 0.07; 'from:addr:andy': 0.09; 'run.': 0.09; 'gui': 0.14; 'wrote:': 0.14; 'baxter': 0.16; 'subject:threads': 0.16; 'threading': 0.16; 'fine': 0.18; 'command': 0.19; 'header:In-Reply-To:1': 0.22; 'convert': 0.22; 'loop': 0.22; 'subject:problem': 0.25; "i'm": 0.26; 'function': 0.27; 'looks': 0.28; 'hi,': 0.29; 'andy': 0.31; 'lock': 0.31; 'solved': 0.31; 'threads.': 0.31; 'to:addr:python- list': 0.32; 'another': 0.32; "i've": 0.33; 'header:User-Agent:1': 0.35; 'releases': 0.35; 'getting': 0.36; 'problems': 0.37; 'data': 0.37; 'raw': 0.37; 'subject:with': 0.37; 'thread': 0.38; 'but': 0.38; 'port': 0.38; 'to:addr:python.org': 0.39; 'reads': 0.65; 'midi': 0.84; 'received:2': 0.91; 'usb': 0.95 Date: Sat, 14 May 2011 19:51:37 +0100 From: andy baxter User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: threads with gtk gui problem References: <4DCE7FCC.8020907@gmail.com> In-Reply-To: <4DCE7FCC.8020907@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-SpamPro: 1.2 X-Spam-Score: -0.9 (/) X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server28.dayanadns.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - earthsong.free-online.co.uk X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305399104 news.xs4all.nl 41103 [::ffff:82.94.164.166]:40350 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5380 On 14/05/11 14:12, Andy Baxter wrote: > Hi, > > I'm working on adding a Gtk GUI to a python program. Its main function > is to read raw data from an arduino board over USB, and convert it to > MIDI note/controller events to be sent to another program. I've had it > working fine with just a command line interface, but when I replaced > the command line with a Gtk interface, I started having problems > getting the thread that reads the USB port to run. I've solved this by adding 'import gobject' and 'gobject.threads_init()' to the start of the program. Looks like if you don't do this then the gtk main loop never releases the python threading lock to other threads. andy