Icalendar

Résolu
tatal21820 Messages postés 35 Date d'inscription   Statut Membre Dernière intervention   -  
tatal21820 Messages postés 35 Date d'inscription   Statut Membre Dernière intervention   -

Bonjour à tous,

je suis débutant et je solliciterais un peu d'aide.

Voilà je fais une petite application pour récupérer mes RDV, le soucis est que mon Label ne s'affiche qu'après le délai configuré avec "INTERVAL" (à 2 secondes pour les essais) prévus à 5 min après.

Comment faire SVP pour qu'il s'affiche de suite et se mettre à jour après.

d'avance Merci.

import locale
import urllib.request
from datetime import timedelta, datetime
from tkinter import *
import icalendar
import pytz
import recurring_ical_events

INTERVAL = 2000

master = Tk()
locale.setlocale(locale.LC_ALL, "fr_FR")
# master.attributes("-fullscreen", True)
# master.bind("<Escape>", lambda e: master.destroy())
master.config(background="black")
master.geometry("750x500")
frm4 = LabelFrame(master, text="Tatal", font="helvetica 15", fg="WHITE", bg="black", height=800, relief=GROOVE)
frm4.place(x=20, y=10, width=500)


def task():
    # Agenda Tatal
    dat2 = datetime.now(pytz.timezone("Europe/Paris"))
    start_date = dat2.date()
    end_date = start_date + timedelta(days=7)
    URL = "https://calendar.google.com/calendar/ical/*******gmail.com/private-***********" \
          "/basic.ics"

    ical_string = urllib.request.urlopen(URL).read()
    calendar = icalendar.Calendar.from_ical(ical_string)
    events = recurring_ical_events.of(calendar).between(start_date, end_date)

    for lbl in frm4.winfo_children():
        lbl.destroy()

    for event in events:
        start = event["DTSTART"].dt
        duration = event["DTEND"].dt - event["DTSTART"].dt
        non = event["SUMMARY"]
        agd_tatal = Label(frm4, text=non + "  " + start.strftime("%A %d %B %Hh%M"), font="Arial 16", fg="WHITE",
                          bg="black")
        agd_tatal.pack(padx=10, pady=10)

    if not events:
        agd_tatal = Label(frm4, text="Aucun rendez-vous aujourdhui", font="Arial 12", fg="WHITE", bg="black")
        agd_tatal.pack(padx=10, pady=10)
    # Re-run this task in INTERVAL milliseconds
    master.after(INTERVAL, task)


master.after(INTERVAL, task)
master.mainloop()



Windows / Chrome 105.0.0.0

A voir également:
  • Icalendar
  • Icalendar - Télécharger - Organisation

2 réponses

hypothetix Messages postés 224 Date d'inscription   Statut Membre Dernière intervention   66
 

Bonjour,

en ligne 51 :

master.after(0, task)
0
tatal21820 Messages postés 35 Date d'inscription   Statut Membre Dernière intervention  
 

Un grand MERCI à toi, ça fonctionne

Merci

0