domingo, 25 de noviembre de 2018

Calendario P10


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env phyton

#- * - coding: utf - 8 -*-
#Simple calendario con tkinter

import calendar
import Tkinter as tk
import datetime


ano = datetime.date.today ().year
mes = datetime.date.today ().month


def writeCalendar(ano, mes):
    

    str1 = calendar.month (ano, mes)
    label1.configure (text=str1)

def mesAnterior():
    global mes, ano
    mes -= 1
    if ano == 0:
     mes = 12
    ano -= 1
    writeCalendar (ano, mes)


def mesSiguiente():
    global mes, ano
    mes += 1
    if mes == 13:
     mes = 1
    ano += 1
    writeCalendar (ano, mes)


root = tk.Tk ()
root.title ("Calendario")



label1 = tk.Label (root, text="", font=('courier', 40, 'bold'), bg='white', justify=tk.LEFT)
label1.grid (row=1, column=1)



frame = tk.Frame (root, bd=5)
anterior = tk.Button (frame, text="Anterior", command=mesAnterior)
anterior.grid (row=1, column=1, sticky=tk.W)
siguiente = tk.Button (frame, text="Siguiente", command=mesSiguiente)
siguiente.grid (row=1, column=2)
frame.grid (row=2, column=1)

writeCalendar (ano, mes)



root.mainloop ()

No hay comentarios.:

Publicar un comentario