Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5128

Re: NewBie Doubt in Python Thread Programming

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <tacyt1007@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.04; 'thread,': 0.04; 'terminated': 0.07; 'manipulate': 0.09; 'signals': 0.09; 'am,': 0.14; 'wrote:': 0.14; 'subject:Programming': 0.16; 'subject:Thread': 0.16; 'threading': 0.16; 'url:riverbankcomputing': 0.16; 'header:In-Reply-To:1': 0.22; 'mechanism': 0.22; 'thu,': 0.22; 'slots': 0.23; 'objects': 0.24; 'received:209.85.212': 0.25; 'classes': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'widget': 0.31; 'are:': 0.31; 'to:addr:python-list': 0.32; 'url:docs': 0.33; 'created': 0.33; 'using': 0.34; 'there': 0.35; 'url:uk': 0.36; 'case,': 0.36; 'event': 0.37; 'received:209.85': 0.37; 'thread': 0.38; 'received:google.com': 0.38; 'used': 0.38; 'not,': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'finished': 0.40; 'would': 0.40; 'header:Received:5': 0.40; 'hand': 0.61; '2011': 0.62; 'upon': 0.63; 'special': 0.66; 'deal.': 0.68; 'advantages': 0.77; '(running': 0.91; 'running,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=xQwRfnHX2oiWDKiX8hu5dRUwsD7sNcckaQcTaCi1fZA=; b=A6eTNxqgblq/T0WaaLBzqxy4387jJJE22LsMBifNwSPFdh30GVFZj6s2D8tVDiq7zT ykNwsKg5VkWkqU5itbZwXKv379xNnfBOr3ymk95XWMc9+zhCkzgiczhAE74U3BDpfQiu cbtWObEA9h86EmKrM+Sv98ROoe1U7J3V9GxUo=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=vEJ9LmbfrH1O15omPTt68TtVoqY+ntg6No8uSmVrJrxn1XLaodzCzShL0P7/LfKHyR X5bAmSkfukdrYM77alYg6n8czR5HaJIia1nPaHhIL7LdbO+bclgOFea33hzsAFTXI1bP EGtP0E3SVGY73eM4QAXZJjWhOPFXhP/a4VvJ8=
MIME-Version 1.0
In-Reply-To <BANLkTiksGud8_Z=+_fu8ij4T+6gizcGt+w@mail.gmail.com>
References <BANLkTikr8fu1sDrfu2a-wyEN_KpVVNCdew@mail.gmail.com> <BANLkTik_ZLvgUVuttiGKQshLmnkU_Mvk+g@mail.gmail.com> <BANLkTin7fq7ybKq94ZUs-7X8dLu7_UFnrQ@mail.gmail.com> <BANLkTi=1ovD0w690xY3cyRwx5C4oPpQY5Q@mail.gmail.com> <BANLkTim-4eHSJe8jc9QcDo-ZfzOHxFg=5w@mail.gmail.com> <BANLkTimPEB8GCAOHQY4-V53eTHr6Rzt87Q@mail.gmail.com> <BANLkTim4kHycVmtQvDYy4rXz9KApguak=g@mail.gmail.com> <BANLkTiksGud8_Z=+_fu8ij4T+6gizcGt+w@mail.gmail.com>
Date Wed, 11 May 2011 17:55:19 +0200
Subject Re: NewBie Doubt in Python Thread Programming
From Wojtek Mamrak <tacyt1007@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.1409.1305129323.9059.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 82.94.164.166
X-Trace 1305129323 news.xs4all.nl 41113 [::ffff:82.94.164.166]:37432
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5128

Show key headers only | View raw


2011/5/11 Chris Angelico <rosuav@gmail.com>:
> On Thu, May 12, 2011 at 1:16 AM, Wojtek Mamrak <tacyt1007@gmail.com> wrote:
>> Is there any special reason you don't want to use QThread?
>> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qthread.html#details
>
> Other than that QThread is part of QT and threading isn't, what are
> the advantages of QThread? Is it possible (safe) to manipulate QT
> objects - in this case, the button - from a thread other than the one
> that created them? (If not, that would be a good reason for using
> QThread, which will fire an event upon termination.)
>


QThread provides mechanism of signals and slots ("from" and "to" the
thread), which are used across all pyQt. Unfortunately it is not
possible to use any widget classes in the thread (direct quote from
the docs). On the other hand signals can fire methods from the main
thread (running the app'a main loop), so this is not a big deal.
The signals are:
- finished
- started
- terminated
It is possible to block the thread, make it sleep, check whether the
thread is running, and few others.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: NewBie Doubt in Python Thread Programming Wojtek Mamrak <tacyt1007@gmail.com> - 2011-05-11 17:55 +0200

csiph-web