from tkinter import Tk,Label,Entry,StringVar,IntVar,Checkbutton,Button,Text,END,messagebox from tkinter.ttk import Scrollbar import os,getpass try: import ext.crud as crud except: import crud import smtplib from email.mime.text import MIMEText import io from color import Color def conn(): global theme2,color,color2,banner,banner1,banner_name2 try: theme=io.open("configs\\themes\\theme.thm","r") theme2=theme.readlines() print("THEME-NAME: ",theme2[0].rstrip(" \n")) try: color_class=Color(theme2[1].rstrip(" \n")) except: color_class=Color("#000000") color=color_class.get() print(len(color)) color2_class=Color(theme2[2].rstrip("\n")) color2=color2_class.get() banner=Color(theme2[3].rstrip("\n")) banner1=Color(theme2[4].rstrip("\n")) banner=banner.get() banner1=banner1.get() banner_name2=theme2[5].rstrip("\n") theme.close() del(theme) except ValueError: messagebox.showwarning("ColorError","Uno/s color no esta bien escrito") raise(ValueError) except: try: os.mkdir("configs") except: pass try: os.mkdir("configs\\themes") except: pass theme=io.open("configs\\themes\\theme.thm","w") theme.write("Photoshop-theme\n#5e5c5c\n#ffffff\n#5e5c5c\n#ffffff\nSERVIDOR FTP V6.5") theme.close() theme=io.open("configs\\themes\\theme.thm","r") theme2=theme.readlines() theme.close() color_class=Color(theme2[1].rstrip(" \n")) color=color_class.get() color2_class=Color(theme2[2].rstrip(" \n")) color2=color2_class.get() banner=Color(theme2[3].rstrip("\n")) banner1=Color(theme2[4].rstrip("\n")) banner=banner.get() banner1=banner1.get() banner_name2=theme2[5].rstrip(" \n") del(theme) print("THEME-NAME: ",theme2[0].rstrip(" \n")) conn() root=Tk() root.title("Puntuanos") root.geometry("340x220") root.config(bg=color) user=StringVar() user.set(getpass.getuser()) r1=IntVar() r2=IntVar() r3=IntVar() r4=IntVar() r5=IntVar() l1=Label(text="Usuario",fg=color2,bg=color) l1.place(x=30,y=20) l2=Label(text="Mensaje",fg=color2,bg=color) l2.place(x=30,y=110) l3=Label(text="Puntuación",fg=color2,bg=color) l3.place(x=30,y=63) e1=Entry(textvariable=user,width=32,fg=color2,bg=color) e1.place(x=100,y=20) t1=Text(width=24,height=3,fg=color2,bg=color) t1.insert(0.1,"La app me a encantado") s1=Scrollbar(command=t1.yview) s1.place(x=300,y=95) t1.place(x=100,y=95) t1.config(yscrollcommand=s1.set) punt=0 def punt1(): if r5.get()==1 or r4.get()==1 or r3 .get()==1 or r2.get()==1: r5.set(0) r4.set(0) r3.set(0) r2.set(0) punt="⭐❌❌❌❌" elif r1.get()==1: pass else: r1.set(0) punt="❌❌❌❌❌" def punt2(): if r5.get()==1 or r4.get()==1 or r3.get()==1 or r1.get()==1: r5.set(0) r4.set(0) r3.set(0) r1.set(1) punt="⭐⭐❌❌❌" elif r1.get()==0: r1.set(1) r2.set(1) else: r2.set(0) punt="⭐❌❌❌❌" def punt3(): if r5.get()==1 or r4.get()==1 or r2.get()==1 or r1.get()==1: r5.set(0) r4.set(0) r2.set(1) r1.set(1) punt="⭐⭐⭐❌❌" elif r1.get()==0: r1.set(1) r2.set(1) r3.set(1) else: r3.set(0) punt="⭐⭐❌❌❌" def punt4(): if r5.get()==1 or r3.get()==1 or r2.get()==1 or r1.get()==1: r5.set(0) r3.set(1) r2.set(1) r1.set(1) punt="⭐⭐⭐⭐❌" elif r1.get()==0: r1.set(1) r2.set(1) r3.set(1) r4.set(1) else: r4.set(0) punt="⭐⭐⭐❌❌" def punt5(): if r5.get()==1: r1.set(1) r2.set(1) r3.set(1) r4.set(1) punt="⭐⭐⭐⭐⭐" elif r1.get()==0: r1.set(1) r2.set(1) r3.set(1) r4.set(1) r5.set(1) else: punt="⭐⭐⭐⭐❌" r5.set(1) punt5() c_1=Checkbutton(variable=r1,onvalue=1,offvalue=0,command=punt1,selectcolor=color,fg=color2,bg=color,overrelief="sunken") c_2=Checkbutton(variable=r2,onvalue=1,offvalue=0,command=punt2,selectcolor=color,fg=color2,bg=color,overrelief="sunken") c_3=Checkbutton(variable=r3,onvalue=1,offvalue=0,command=punt3,selectcolor=color,fg=color2,bg=color,overrelief="sunken") c_4=Checkbutton(variable=r4,onvalue=1,offvalue=0,command=punt4,selectcolor=color,fg=color2,bg=color,overrelief="sunken") c_5=Checkbutton(variable=r5,onvalue=1,offvalue=0,command=punt5,selectcolor=color,fg=color2,bg=color,overrelief="sunken") c_1.place(y=62,x=125) c_2.place(y=62,x=155) c_3.place(y=62,x=185) c_4.place(y=62,x=215) c_5.place(y=62,x=245) def send(): mailServer = smtplib.SMTP('smtp.nauta.cu',25) mailServer.ehlo() mailServer.starttls() mailServer.ehlo() mailServer.login("borisdanielmm@nauta.cu",crud.decode("YmFsYmlub3RBMTIu")) mensaje = MIMEText("\n"+"Puntuación: "+punt+"\n"+t1.get("1.0",END)) mensaje['From']="borisdanielmm@nauta.cu" mensaje['To']="borisdanielmm@nauta.cu" mensaje['Subject']="Calificación" # Envio del mensaje mailServer.sendmail("borisdanielmm@nauta.cu", "borisdanielmm@nauta.cu", mensaje.as_string()) mailServer.close() b1=Button(text="Enviar",overrelief="sunken",command=send,fg=color2,bg=color,width=20) b1.place(x=92,y=170) root.mainloop()