Coder Social home page Coder Social logo

reminder-python's Introduction

Reminder-python

Berikut adalah contoh script Python yang dapat digunakan untuk mengirim notifikasi setiap jam 10 pagi hingga 3 sore:

import time

from plyer import notification

def send_notification():

    title = "Pengingat"

    message = "Waktunya istirahat sebentar!"

    notification.notify(title=title, message=message, timeout=10)

# Menentukan rentang waktu untuk mengirim notifikasi (10:00 - 15:00)

start_time = time.strptime("10:00:00", "%H:%M:%S")

end_time = time.strptime("15:00:00", "%H:%M:%S")

while True:

    current_time = time.localtime()

    if start_time <= current_time <= end_time:

        send_notification()

    # Menunggu 1 jam sebelum memeriksa lagi

    time.sleep(3600)  # 3600 detik = 1 jam

Pada contoh di atas, kami menggunakan pustaka plyer untuk mengirim notifikasi pada sistem operasi yang Anda gunakan. Pastikan untuk menginstal pustaka tersebut sebelum menjalankan script dengan menggunakan perintah pip install plyer.

Script ini akan berjalan secara terus menerus dan memeriksa waktu saat ini setiap jam. Jika waktu saat ini berada di antara rentang waktu yang ditentukan (10:00 pagi hingga 3:00 sore), maka akan dikirimkan notifikasi sebagai pengingat.

Harap diperhatikan bahwa beberapa sistem operasi mungkin memerlukan izin atau konfigurasi tambahan agar notifikasi dapat ditampilkan. Pastikan untuk memeriksa dokumentasi sistem operasi yang Anda gunakan.

reminder-python's People

Contributors

manyar-su avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.