Advertisement
teslariu

Untitled

Dec 14th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import tkinter as tk
  4. def imprimir_lista():
  5.     for alumno, curso in alumno.items():
  6.         print(alumno, curso)
  7.    
  8. def agregar_a_lista():
  9.     nombre = caja_nombre.get()
  10.     cursos = caja_curso.get()
  11.     alumnos[nombre] = cursos
  12.    
  13. def ver_cursos():
  14.     print(f"El alumno {caja_nombre.get} tiene {alumnos[caja_nombre.get()]}")    
  15.    
  16. alumno = {} #alumnos= (pepe:4, ana:4)
  17.  
  18.  
  19.  
  20. ventana = tk.Tk()
  21. ventana.config(width=400, height=300)
  22. ventana.title('Proyecto integrador')
  23.  
  24.  
  25. # bton Ver lista de alumnos
  26. boton = tk.Button(text='Ver lista de alumnos', command=imprimir_lista)
  27. boton.place(x=20, y=10, width=150, height=30)
  28.  
  29. # bton agregar a la lista
  30. boton = tk.Button(text='Agregar a la lista', command=agregar_a_lista)
  31. boton.place(x=20, y=170, width=150, height=30)
  32.  
  33. # bton Ver cantidad de cursos
  34. boton = tk.Button(text='Ver cursos', command=ver_cursos)
  35. boton.place(x=200, y=170, width=150, height=30)
  36.  
  37.  
  38.  
  39.  
  40. ##### CAMPO DE DATOS #######
  41.  
  42. # nombre
  43. caja_nombre = tk.Entry()
  44. caja_nombre.place(x=150, y=60, width=170, height=25)
  45. etiqueta = tk.Label(text='Nombre Alumno:')
  46. etiqueta.place(x=40, y=60)
  47.  
  48. # cursos
  49. caja_curso = tk.Entry()
  50. caja_curso.place(x=150, y=120, width=170, height=25)
  51. etiqueta = tk.Label(text='Cursos: ')
  52. etiqueta.place(x=60, y=120)
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. ventana.mainloop()
  61.  
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement