Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'url:launchpad': 0.05; 'happen,': 0.07; 'mouse': 0.07; 'imports': 0.09; 'looked': 0.10; 'gui': 0.11; '(like': 0.15; 'frankly': 0.16; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'received:80.12.204': 0.16; 'received:80.12.204.220': 0.16; 'received:meplus.info': 0.16; 'received:mobistar.be': 0.16; 'received:smtp-out.mobistar.be': 0.16; 'simple.': 0.16; 'stuff.': 0.16; 'there?': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'creates': 0.18; 'handles': 0.18; 'app': 0.19; 'define': 0.20; 'written': 0.20; 'bit': 0.21; 'example': 0.23; 'this:': 0.23; "haven't": 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'ago': 0.27; 'am,': 0.27; 'question': 0.27; 'execution': 0.27; 'object,': 0.27; 'primarily': 0.27; 'see,': 0.27; 'lines': 0.28; 'run': 0.28; 'skip:q 20': 0.29; 'case,': 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'received:(smtp server)': 0.30; 'window': 0.30; 'on,': 0.30; 'code': 0.31; 'point': 0.31; 'operate': 0.32; 'could': 0.32; 'loading': 0.33; 'to:addr:python-list': 0.33; 'doing': 0.35; 'something': 0.35; 'michael': 0.36; 'but': 0.36; 'closing': 0.36; "i'll": 0.36; 'should': 0.36; 'two': 0.37; 'item': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'fact': 0.38; 'some': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'received:192': 0.39; 'called': 0.39; 'received:192.168': 0.40; 'end': 0.40; 'your': 0.60; 'days': 0.60; 'link': 0.60; 'you.': 0.61; 'first': 0.61; 'gave': 0.65; 'received:80.12': 0.65; 'received:info': 0.69; 'dense': 0.84; 'singing': 0.84; 'start.': 0.84; 'rusi': 0.91; 'themed': 0.91; 'tomorrow': 0.96 X-ME-UUID: 20120715075837962.EADE8A0000E1@mwinf8112.mobistar.be X-ME-bounce-domain: mobistarmail.be Date: Sun, 15 Jul 2012 09:58:37 +0200 From: Vincent Vande Vyvre User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python and Qt4 Designer References: <63ac761b-a0a2-4d77-a3ca-f93069fab82a@s1g2000vbj.googlegroups.com> <1bb0d4df-3937-4d5f-aedb-734e0c54eb85@f9g2000pbd.googlegroups.com> <500255BA.5080102@gmail.com> In-Reply-To: <500255BA.5080102@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342339126 news.xs4all.nl 6923 [2001:888:2000:d::a6]:32847 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25339 On 15/07/12 07:31, Michael Torrie wrote: > On 07/14/2012 11:13 AM, rusi wrote: >> I looked at the second link and find code like this: >> >> app = None if ( not app ): app = QtGui.QApplication([]) >> >> Maybe I'm dense but whats that if doing there? >> >> Frankly I seem to be a bit jinxed with gui stuff. A few days ago >> someone was singing the praises of some new themed tk stuff. I could >> not get the first two lines -- the imports -- to work and then gave >> up > Since you haven't had any experience with gui development then probably > loading ui files isn't the right place to start. First principles > (creating gui widgets from scratch) would be it. > > In any case, the line in question is quite simple. It creates a > QApplication object, which is basically the engine that drives all Qt > applications. Once you call .run() on it, it takes over and handles all > the mouse events and such for you. In fact you do not have any control > over the program's execution from this point on, other than to define > event call-back methods or functions that are called by the widgets when > things happen, like mouse clicks. > > All gui toolkits operate this way. You set up the widgets, then you run > the main engine or main event loop and control never returns to your > main program until something triggers the end (like closing a window or > the quit menu item is pressed). > > Probably a complete working example is what you need to see, that is > documented. I primarily work with Gtk, but I'll whip up a Qt one > tomorrow if I can. Rusi is not the op, and his question is about these lines app = None if ( not app ): not this one app = QtGui.QApplication([]) which should be written like this app = QtGui.QApplication(sys.argv) -- Vincent V.V. Oqapy . Qarte . PaQager