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


Groups > comp.lang.python > #25337

Re: Python and Qt4 Designer

Date 2012-07-14 23:31 -0600
From Michael Torrie <torriem@gmail.com>
Subject Re: Python and Qt4 Designer
References (2 earlier) <b6a17f2f-1653-4c4e-a50e-af13c1eabcd7@n16g2000vbn.googlegroups.com> <mailman.2060.1342144373.4697.python-list@python.org> <d3ed2da1-d1c5-4d1f-bd66-cceb9248bfce@googlegroups.com> <mailman.2114.1342278483.4697.python-list@python.org> <1bb0d4df-3937-4d5f-aedb-734e0c54eb85@f9g2000pbd.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2129.1342330310.4697.python-list@python.org> (permalink)

Show all headers | View raw


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.

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


Thread

[newbie] Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-11 08:37 -0700
  Re: [newbie] Python and Qt4 Designer Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-07-12 02:59 +0200
    Re: Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-11 23:42 -0700
      Re: Python and Qt4 Designer Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-07-13 03:52 +0200
        Re: Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-13 14:12 -0700
          Re: Python and Qt4 Designer Michael Torrie <torriem@gmail.com> - 2012-07-14 08:45 -0600
            Re: Python and Qt4 Designer rusi <rustompmody@gmail.com> - 2012-07-14 10:13 -0700
              Re: Python and Qt4 Designer Michael Torrie <torriem@gmail.com> - 2012-07-14 23:31 -0600
              Re: Python and Qt4 Designer Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-07-15 09:58 +0200
              Re: Python and Qt4 Designer Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-15 08:42 -0400
              Re: Python and Qt4 Designer Michael Torrie <torriem@gmail.com> - 2012-07-16 07:56 -0600
              Re: Python and Qt4 Designer Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-16 13:07 -0400
        Re: Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-13 14:12 -0700

csiph-web