Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My_first_Calendar
#1
Hola soy muy nueva en Python, estoy intentando crear un calendario con este código.

from tkinter import *
from tkcalendar import *

root = Tk()
root. Title("Calendario")
root. Geometry("500x350")
root.config(bg="gray")
cal = Calendar(root, select="day", year=2024, month=5, day=28)
cal.pack(pady=20, fill='both', expand='yes')

def Fecha():
    Label_text.config(text="Fecha de hoy " + cal.get_date())

Button = Button(root, text="fecha", command=Fecha)
Button.pack(pady=20)

Label_text = Label(root, text="")
Label_text.pack(pady=20)

root.mainloop()
He configurado el Path e instalado tkcalendar, al ejecutar el código me sale este error:
"NameError: name 'Calendar' is not defined" no sé cómo resolverlo.

¿Alguien podría ayudarme?
Gracias!
Gribouillis write May-28-2024, 08:11 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
My_first_Calendar - by Finally_Laura - May-28-2024, 06:17 PM
RE: My_first_Calendar - by Pedroski55 - May-28-2024, 10:04 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020