Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    Python - උදව්වක් (දෙන ලද කාලයට අනුව function එකක් call කරන්න)

    Programming
    python tkinter programming desktop os
    4
    7
    1158
    Loading More Posts
    • 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.
    • M
      malinga91 last edited by

      Python experts.. උදව්වක් ඕන... මං පොඩි program එකක් ලිව්වා. එකේදි වෙන්නේ define කරපු වේලාවල් වලදි function එකක් call කරන එක. දැනට වෙන්නේ තත්පරෙන් තත්පරෙට check කරනවා දීපු time එකයි, දැන් time එකයි සමානද කියලා. මීට වඩා හොද විදියක් තියෙනවද?

      from datetime import datetime
      
      #Times tuple
      timesTuple = ("09:37:00 PM", "09:38:00 PM", "09:39:00 PM", "10:33:00 PM", "10:50:00 PM", "11:30:00 PM", "12:10:00 PM", "12:50:00 PM", "01:30:00 PM")
      
        
      # This function is used to  
      # display time on the label 
      def time(): 
       
          datetime_object = datetime.today()
          now = datetime.strftime(datetime_object,'%l:%M:%S %p')
      
          for x in timesTuple:
              timeOne = datetime.strftime(datetime.strptime(x, "%I:%M:%S %p"),'%l:%M:%S %p')
              if now == timeOne:
                  playSound() 
                  print("Fire bell at : " + x)
                  print("------------")
      
      
      #execute timer
      time()
      
      
      Nubelle 1 Reply Last reply Reply Quote 0
      • Nubelle
        Nubelle Web Development @malinga91 last edited by

        @malinga91 said in Python - උදව්වක් (දෙන ලද කාලයට අනුව function එකක් call කරන්න):

        timesTuple

        @root will be help to solve this

        1 Reply Last reply Reply Quote 1
        • root
          root Linux Help last edited by

          @malinga91 machan me library eken oyage wade lesiyenma karnana puluwan.

          https://github.com/dbader/schedule

          M 1 Reply Last reply Reply Quote 1
          • M
            malinga91 @root last edited by

            @root Thanks machan. Man try karala balannam

            1 Reply Last reply Reply Quote 0
            • M
              malinga91 last edited by

              @root man try kara machan. weda. eth tkinter ekka use karaddi window eka open wenne nehe. :(

              root 1 Reply Last reply Reply Quote 0
              • b6
                b6 last edited by b6

                @malinga91
                You should try

                >> python -u yourscript.py
                

                Do not use

                >> python yourscript.py
                
                1 Reply Last reply Reply Quote 1
                • root
                  root Linux Help @malinga91 last edited by

                  @malinga91

                  python GUI mama use karala na machan. mama python use karanne automation script liyanna witharai.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post

                  0
                  Online

                  3.6k
                  Users

                  1.3k
                  Topics

                  5.3k
                  Posts

                  • Privacy
                  • Terms & Conditions
                  • Donate

                  © Copyrights and All right reserved Lanka Developers Community

                  Powered by Axis Technologies (PVT) Ltd

                  Made with in Sri Lanka

                  | |