Hoola give me a file called notes.txt the file looks like this:
NOTAS;EJERCICIO 1;EJERCICIO 2;EJERCICIO 3;EJERCICIO 4;EJERCICIO
AAAA;2;4;7;2;6;4
BBBB;3;5;5;4;5;5
CCCC;4;6;5;5;4;6
DDDD;5;7;5;6;4;4
I need to Open and upload the file notes.txt
Using Tkinter - Show in a dropdown (menuoption) the names of students
Using Tkinter - Show all the student's grades and if this is approved or disapproved (approved - notes = 4.0)
WHAT I HAVE IS THE FOLLOWING .. YOU COULD GIVE ME A PLEASANT HAND ..
from Tkinter import*
from ttk import*
ventana=Tk()
ventana.title('Notas')
cuadro1=Frame(ventana)
cuadro1.pack()
cuadro2=Frame(ventana)
cuadro2.pack()
texto=StringVar()
#Abrir el archivo con open('notas.txt', 'r') y luego recorremos cada linea
# que vamos leyendo
#Luego, despues de la linea 0. Guardamos nuestras notas en el diccionario
#"notas={}"
#Por cada linea que vaya leyendo, usamos una función que nos separe la linea
#de su componentes
#LineaComoLista=linea.split(;) y nos quedara algo asi['LLLL', '1', '2', '7']
#Queremos hacer algo como esto: notas['LLLL']=['1', '2', '7']
#Y LineaComoLista[1:]=['1', '2', '7']
#Al final lo que vamos a tener es un diccionario con los nombres de los
#alumnos y sus notas
#Uno puede acceder a las llaves de un diccionario con notas.keys() ->
#entrega una lista con los nombres de los alumnos
valores=notas.keys()
menu=OptionMenu(cuadro1,texto,*valores)
subtitulo=Label(cuadro1, text='Notas de alumno', font=(None, 20))
subtitulo.grid(row=1, column=1)
menu.grid(row=2, column=1)
def LeerNotas(*args):
NombreDelAlumno=texto.get()
subtitulo.config(text='Notas de' + NombreDelAlumno)
NumeroDeNotas = 6
for y in range(0,5):
etiqueta=Label(cuadro2, text=str(LeerNotas[y]), font=(None, 30),
relief=RIDGE)
etiqueta.grid(row=0, column=y, sticky=NSEW)
texto.trace('r', LeerNotas)
ventana.mainloop()
THANKS