martes, 5 de marzo de 2019

Programa zodiacal.

Se elabor un programa que te indica tu signo zodiacal.


# -*- coding: utf-8 -*-
import sys
import Tkinter as tk
from Tkinter import *
import tkMessageBox

ventana = Tk()
ventana.title("Tu signo Zodiacal ")
ventana.geometry("400x200")
ventana.config(bg="light steel blue")

vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
        pady=(10, 10))  # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="light steel blue")


var = StringVar(vp)
ver = StringVar(vp)
var.set("Enero")  # initial valuever = StringVar(ventana)
ver.set("1")  # initial value
etiqueta_mes = Label(vp, text='Mes de nacimiento: ')
ent_mes = OptionMenu(vp, var, "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto",
                     "Septiembre", "Octubre", "Noviembre", "Diciembre", )
etiqueta_mes.grid(row=1, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ent_mes.grid(row=1, column=3)

etiqueta_dia = Label(vp, text='Fecha de nacimiento: ')
ent_dia = OptionMenu(vp, ver, "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")
etiqueta_dia.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ent_dia.grid(row=4, column=3)


def signo():
    month = str(var.get())
    day = int(ver.get())
    if month == "Marzo" and day >= 21 or month == "Abril" and day <= 20:
        tkMessageBox.showinfo("Signo ", " Aries")
    elif month == "Abril" and day >= 21 or month == "Mayo" and day <= 21:
        tkMessageBox.showinfo("Signo", " Tauro")
    elif month == "Mayo" and day >= 22 or month == "Junio" and day <= 21:
        tkMessageBox.showinfo("Signo", " Gemenis")
    elif month == "Junio" and day >= 22 or month == "Julio" and day <= 22:
        tkMessageBox.showinfo("Signo", " Cancer")
    if month == "Julio" and day >= 23 or month == "Agosto" and day <= 23:
        tkMessageBox.showinfo("Signo", " Leo")
    if month == "Agosto" and day >= 24 or month == "Septiembre" and day <= 23:
        tkMessageBox.showinfo("Signo", " Virgo")
    if month == "Septiembre" and day >= 24 or month == "Octubre" and day <= 23:
        tkMessageBox.showinfo("Signo", " Libra")
    if month == "Octubre" and day >= 24 or month == "Noviembre" and day <= 22:
        tkMessageBox.showinfo("Signo", "Eres Escorpion")
    if month == "Noviembre" and day >= 23 or month == "Diciembre" and day <= 21:
        tkMessageBox.showinfo("Signo", "Eres Sagitario")
    if month == "Diciembre" and day >= 22 or month == "Enero" and day <= 20:
        tkMessageBox.showinfo("Signo", "Eres Capricornio")
    if month == "Enero" and day >= 21 or month == "Febrero" and day <= 18:
        tkMessageBox.showinfo("Signo", "Eres Acuario")
    if month == "Febrero" and day >= 19 or month == "Marzo" and day <= 20:
        tkMessageBox.showinfo("Signo", "Eres Piscis")


boton = Button(vp, text='Signo', command=signo, width=20)
boton.grid(row=5, column=1, padx=(10, 10), pady=(10, 10), sticky=E)

ventana.mainloop()