Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import tkinter as tk
- def imprimir_lista():
- for alumno, curso in alumno.items():
- print(alumno, curso)
- def agregar_a_lista():
- nombre = caja_nombre.get()
- cursos = caja_curso.get()
- alumnos[nombre] = cursos
- def ver_cursos():
- print(f"El alumno {caja_nombre.get} tiene {alumnos[caja_nombre.get()]}")
- alumno = {} #alumnos= (pepe:4, ana:4)
- ventana = tk.Tk()
- ventana.config(width=400, height=300)
- ventana.title('Proyecto integrador')
- # bton Ver lista de alumnos
- boton = tk.Button(text='Ver lista de alumnos', command=imprimir_lista)
- boton.place(x=20, y=10, width=150, height=30)
- # bton agregar a la lista
- boton = tk.Button(text='Agregar a la lista', command=agregar_a_lista)
- boton.place(x=20, y=170, width=150, height=30)
- # bton Ver cantidad de cursos
- boton = tk.Button(text='Ver cursos', command=ver_cursos)
- boton.place(x=200, y=170, width=150, height=30)
- ##### CAMPO DE DATOS #######
- # nombre
- caja_nombre = tk.Entry()
- caja_nombre.place(x=150, y=60, width=170, height=25)
- etiqueta = tk.Label(text='Nombre Alumno:')
- etiqueta.place(x=40, y=60)
- # cursos
- caja_curso = tk.Entry()
- caja_curso.place(x=150, y=120, width=170, height=25)
- etiqueta = tk.Label(text='Cursos: ')
- etiqueta.place(x=60, y=120)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement