[PyQt] wx.MilliSleep equivalent

Tong Zhang warriorlance at gmail.com
Fri Sep 21 20:51:15 BST 2018


Thanks Jones, QTimer.singleShot is a nice solution if you have nothing 
to do after this single line of code, or the right after consecutive 
code will be executed before the callback wrapped within singleShot 
method, which sometimes is not wanted.

IMHO, qWait, qSleep and other functions, should be exposed somewhere at 
QTimer's reference page, such that, people like me can easily discover 
them, since normally the Qt users (not core Qt library developers) 
probably would not dive into QTest module to see if something is useful.

Tong

On 09/21/2018 03:40 PM, Jones, Bryan wrote:
> See http://doc.qt.io/qt-5/qtest.html#qWait. Of course, a much better 
> approach is to schedule an event using a timer. To quit an app after 
> 1000 ms, you can use QTimer.singleShot(1000, app.quit), where app is 
> your QApplication instance.
> 
> On Fri, Sep 21, 2018 at 1:23 PM Tong Zhang <warriorlance at gmail.com 
> <mailto:warriorlance at gmail.com>> wrote:
> 
>     Hello,
> 
>     When I'm building applications by wxPython, there is a function
>     wx.MilliSleep could be used to do non-GUI-block sleep, while I
>     cannot find the similar thing in PyQt, is it available or not?
>     Otherwise, what I can do to is to use QThread. Any comment is
>     appreciated!
> 
>     Tong
> 
> 
> 
> -- 
> Bryan A. Jones, Ph.D.
> Associate Professor
> Department of Electrical and Computer Engineering
> 231 Simrall / PO Box 9571
> Mississippi State University
> Mississippi State, MS 39762
> http://www.ece.msstate.edu/~bjones <http://www.ece.msstate.edu/%7Ebjones>
> bjones AT ece DOT msstate DOT edu
> voice 662-325-3149
> fax 662-325-2298
> 
> Our Master, Jesus Christ, is on his way. He'll show up right on
> time, his arrival guaranteed by the Blessed and Undisputed Ruler,
> High King, High God.
> - 1 Tim. 6:14b-15 (The Message)


More information about the PyQt mailing list