Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. add delay in python

add delay in python

Scheduled Pinned Locked Moved Unsolved Language Bindings
5 Posts 4 Posters 4.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dl10
    wrote on 16 Jan 2018, 12:03 last edited by
    #1

    how i adding delay in python? i using PyQt5.
    my intent is function style time.sleep but Other.
    help!
    tnx

    J 1 Reply Last reply 16 Jan 2018, 16:08
    0
    • D Dl10
      16 Jan 2018, 12:03

      how i adding delay in python? i using PyQt5.
      my intent is function style time.sleep but Other.
      help!
      tnx

      J Offline
      J Offline
      JonB
      wrote on 16 Jan 2018, 16:08 last edited by
      #2

      @Dl10
      The usual "Qt style" is to do this via (single-shot) QTimer instead of "delaying", which means redesigning the way your code works. Depends on your usage.

      1 Reply Last reply
      1
      • P Offline
        P Offline
        Pablo J. Rogina
        wrote on 16 Jan 2018, 16:24 last edited by Pablo J. Rogina
        #3

        @Dl10 if you want your application to "pause" for some period of time, I'd say use Python's time.sleep(delay).
        What @JonB suggested is using a "single-shot" timer which let's you do something once the timer goes off.
        So these two approaches are slightly different.

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        J 1 Reply Last reply 16 Jan 2018, 16:27
        0
        • P Pablo J. Rogina
          16 Jan 2018, 16:24

          @Dl10 if you want your application to "pause" for some period of time, I'd say use Python's time.sleep(delay).
          What @JonB suggested is using a "single-shot" timer which let's you do something once the timer goes off.
          So these two approaches are slightly different.

          J Offline
          J Offline
          JonB
          wrote on 16 Jan 2018, 16:27 last edited by JonB
          #4

          @Pablo-J.-Rogina
          It's difficult to guess what the OP means, but he says:

          my intent is function style time.sleep but Other.

          but it seems he is aware of Python time.sleep(delay) but doesn't want to use it...! :)

          1 Reply Last reply
          0
          • W Offline
            W Offline
            windsorperma
            wrote on 10 Apr 2020, 07:35 last edited by
            #5

            Sleep() function actually suspends the processing of the thread in which it is called by the operating system, allowing other threads and processes to execute while it sleeps. With multiple threads and processes, sleep() suspends your thread - it uses next to zero processing power.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved