Execution order

Discussion in 'Python' started by DarkBlue, Sep 11, 2009.

  1. DarkBlue

    DarkBlue Guest

    Here is some code from a pyqt4.5.4 application on python 2.6

    def findData(self):

    self.ui.label.setText('Processing... ')

    # here we do something which takes a few seconds
    self.refreshGrid()



    The problem is that the text in the self.ui.label is only changed
    on screen after the self.refreshGrid() has finished executing
    rather than before.

    How do I achieve the expected result ?

    Thanks
    Db
     
    DarkBlue, Sep 11, 2009
    #1
    1. Advertising

  2. DarkBlue wrote:

    > Here is some code from a pyqt4.5.4 application on python 2.6
    >
    > def findData(self):
    >
    > self.ui.label.setText('Processing... ')
    >
    > # here we do something which takes a few seconds
    > self.refreshGrid()
    >
    >
    >
    > The problem is that the text in the self.ui.label is only changed
    > on screen after the self.refreshGrid() has finished executing
    > rather than before.
    >
    > How do I achieve the expected result ?


    You can make Qt process all pending events once, via
    QCoreApplication.processEvents.

    This should trigger the redraw.

    Diez
     
    Diez B. Roggisch, Sep 11, 2009
    #2
    1. Advertising

  3. DarkBlue

    DarkBlue Guest

    On Sep 11, 9:34 pm, "Diez B. Roggisch" <> wrote:
    > DarkBlue wrote:
    > > Here is some code from a pyqt4.5.4  application on python 2.6

    >
    > > def findData(self):

    >
    > >       self.ui.label.setText('Processing... ')

    >
    > >       # here we do something which takes a few seconds
    > >       self.refreshGrid()

    >
    > > The problem is that the text in the self.ui.label  is only changed
    > > on screen after the self.refreshGrid() has finished executing
    > > rather than before.

    >
    > > How do I achieve the expected result ?

    >
    > You can make Qt process all pending events once, via
    > QCoreApplication.processEvents.
    >
    > This should trigger the redraw.
    >
    > Diez


    Thanks ! That helped. :)
     
    DarkBlue, Sep 11, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. priya
    Replies:
    0
    Views:
    1,238
    priya
    Oct 3, 2005
  2. =?Utf-8?B?QmlsbCBCb3Jn?=

    Execution order of PageLoad for user controls

    =?Utf-8?B?QmlsbCBCb3Jn?=, Mar 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,353
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Mar 6, 2004
  3. Bijoy Naick

    Execution order of Validation Controls

    Bijoy Naick, Jun 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,965
    Martin Marinov
    Jun 8, 2004
  4. John Saunders

    Re: A question about order of execution?

    John Saunders, Jul 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    363
    S. Justin Gengo
    Jul 15, 2004
  5. S. Justin Gengo

    Re: A question about order of execution?

    S. Justin Gengo, Jul 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,060
    S. Justin Gengo
    Jul 15, 2004
Loading...

Share This Page