def error3(): global root7 root7=Tk() root7.resizable(0,0) root7.title("Error") root7.config(bg="#220047") width=450 height=240 screen_width = root7.winfo_screenwidth() screen_height = root7.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root7.geometry('%dx%d+%d+%d' % (width, height, x, y)) errortxt1=Label(root7,text="Error!",font=("georgia",30),bg="#220047",fg="#CE9141") errortxt1.place(x=165,y=7) errortxt2=Label(root7,text="Please fulfill the following requirements for a strong password: "******"georgia",10),bg="#220047",fg="#CE9141") errortxt2.place(x=30,y=65) errortxt3=Text(root7,font=("georgia",10),height=4,width=45,bg="#220047",fg="#CE9141") errortxt3.place(x=20,y=100) errortxt3.insert(END," 1.Password should be atleast 8 character long. \n 2.Must contain atleast one uppercase and lowercase character. \n 3.No special characters are allowed. \n 4. No whitespaces are allowed. ") bt2=Button(root7,text="Try Again",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt2.place(x=250,y=180) bt2.bind("<Button-1>",tryagain3) bt1=Button(root7,text="Get Password",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141",command=getpass) bt1.place(x=50,y=180) root7.mainloop()
def pureregister(event): global Fullname global Email global Username global Password global root3 root3=Tk() root3.resizable(0,0) root3.config(bg="#220047") root3.title("Registration Form") width=500 height=450 screen_width = root3.winfo_screenwidth() screen_height = root3.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root3.geometry('%dx%d+%d+%d' % (width, height, x, y)) Fullname=StringVar() Email=StringVar() Username=StringVar() Password =StringVar() signup_1=Label(root3, text="Sign Up",fg="#CE9141",bg="#220047",width=20,font=("georgia", 40)) signup_1.place(x=-50,y=20) back=Button(root3,text="Back",font=("georgia",10),width=10,fg='#220047',bg='#CE9141',activeforeground="#CE9141",activebackground="#220047") back.place(x=400,y=10) back.bind("<Button-1>",back1) name=Label(root3, text="FullName",fg="#CE9141",bg="#220047",width=20,font=("georgia", 15)) name.place(x=-10,y=125) input1=Entry(root3,textvar=Fullname,width=40) input1.place(x=200,y=130) email= Label(root3, text="Email",fg="#CE9141",bg="#220047",width=20,font=("georgia", 15)) email.place(x=-29,y=175) input2 = Entry(root3,textvar=Email,width=40) input2.place(x=200,y=180) user1= Label(root3,text="Username",fg="#CE9141",bg="#220047",width=20,font=("georgia", 15)) user1.place(x=-10,y=225) input3=Entry(root3,textvar=Username,width=40) input3.place(x=200,y=230) pass1= Label(root3, text="Password",fg="#CE9141",bg="#220047",width=20,font=("georgia", 15)) pass1.place(x=-10,y=275) input4=Entry(root3,textvar=Password,width=40,show="**") input4.place(x=200,y=280) submit1=Button(root3,text='Submit',font=("georgia",20),width=10,fg='#220047',bg='#CE9141',activeforeground="#CE9141",activebackground="#220047",height=1) submit1.place(x=165,y=345) submit1.bind("<Button-1>",datauser) root3.mainloop()
def error4(): global root9 root9=Tk() root9.resizable(0,0) root9.title("Error") root9.config(bg="#220047") width=450 height=230 screen_width = root9.winfo_screenwidth() screen_height = root9.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root9.geometry('%dx%d+%d+%d' % (width, height, x, y)) errortxt1=Label(root9,text="Error!",font=("georgia",30),bg="#220047",fg="#CE9141") errortxt1.place(x=162,y=7) errortxt2=Label(root9,text="No field should be left empty! Make sure you have filled \n the following fields correctly: \n 1.Username \n 2. Fullname ",font=("georgia",12),bg="#220047",fg="#CE9141") errortxt2.place(x=25,y=65) bt2=Button(root9,text="Try Again",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt2.place(x=160,y=155) bt2.bind("<Button-1>",tryagain4) root9.mainloop()
def createplay(event): global name12 global root12 root12=Tk() root12.resizable(0,0) root12.title("Create Playlist") root12.config(bg="#220047") width=400 height=150 screen_width = root12.winfo_screenwidth() screen_height = root12.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root12.geometry('%dx%d+%d+%d' % (width, height, x, y)) name12=StringVar(root12) todo1=Label(root12,text="Name your playlist",font=("roboto",20),bg="#220047",fg="#CE9141") todo1.pack() input0=Entry(root12,textvar=name12,width=50) input0.place(x=50,y=60) submit0=Button(root12,text='Submit',font=("georgia",15),width=10,fg='#220047',bg='#CE9141',activeforeground="#CE9141",activebackground="#220047",height=1,) submit0.place(x=135,y=100) submit0.bind("<Button-1>",savelist) root12.mainloop()
def error2(): global root6 root6=Tk() root6.resizable(0,0) root6.title("Error") root6.config(bg="#220047") width=450 height=200 screen_width = root6.winfo_screenwidth() screen_height = root6.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root6.geometry('%dx%d+%d+%d' % (width, height, x, y)) errortxt1=Label(root6,text="Error!",font=("georgia",30),bg="#220047",fg="#CE9141") errortxt1.place(x=165,y=7) errortxt2=Label(root6,text="The email id entered is not valid , please enter a valid email id ",font=("georgia",10),bg="#220047",fg="#CE9141") errortxt2.place(x=30,y=70) bt2=Button(root6,text="Try Again",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt2.place(x=165,y=120) bt2.bind("<Button-1>",tryagain2) root6.mainloop()
def MAIN(event): global root1 root1=Tk() width=700 height=250 screen_width = root1.winfo_screenwidth() screen_height = root1.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root1.geometry('%dx%d+%d+%d' % (width, height, x, y)) root1.resizable(0,0) root1.config(bg="#220047") root1.title("Welcome") filename = PhotoImage(file ="welcome.png") background_label = Label(image=filename) background_label.place(x=0, y=0, relwidth=1, relheight=1) login=Button(root1,text="Log In",font=("roboto",30),bg="#CE9141",fg="#220047",activeforeground="#b2995d",activebackground="#220047",height=1,width=10) login.place(x=60,y=120) login.bind("<Button-1>",login1) signup1=Button(root1,text="Sign Up",font=("roboto",30),bg="#CE9141",fg="#220047",activeforeground="#b2995d",activebackground="#220047",height=1,width=10) signup1.place(x=390,y=120) signup1.bind("<Button-1>",signup) root1.mainloop()
def getpass(): global root8 x1="" b=random.randint(8,12) while b!=0: a=random.randint(0,2) if a==0: c=random.randint(48,57) chars=chr(c) x1+=chars b-=1 if a==1: c=random.randint(65,90) chars=chr(c) x1+=chars b-=1 if a==2: c=random.randint(97,122) chars=chr(c) x1+=chars b-=1 root8=Tk() root8.resizable(0,0) root8.title("Pass") root8.config(bg="#220047") width=650 height=240 screen_width = root8.winfo_screenwidth() screen_height = root8.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root8.geometry('%dx%d+%d+%d' % (width, height, x, y)) getpass=Label(root8,text="Get Password",font=("georgia",30),bg="#220047",fg="#CE9141") getpass.place(x=200,y=7) instructions=Label(root8,text="Following is a randomly generated password for your convenience , you can copy the password:"******"georgia",10),bg="#220047",fg="#CE9141") instructions.place(x=30,y=80) passwordgiven=Text(root8,font=("georgia",10),height=2,width=45,bg="#220047",fg="#CE9141") passwordgiven.place(x=120,y=120) passwordgiven.insert(END,x1) bt1=Button(root8,text="Regenerate",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt1.place(x=250,y=170) bt1.bind("<Button-1>",regenerate) bt2=Button(root8,text="Close",font=("georgia",10),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt2.place(x=500,y=170) bt2.bind("<Button-1>",close) root8.mainloop()
def login1(event): global Username global Password global root2 root1.destroy() root2=Tk() root2.resizable(0,0) root2.config(bg="#220047") root2.title("Log In") width=500 height=300 screen_width = root2.winfo_screenwidth() screen_height = root2.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root2.geometry('%dx%d+%d+%d' % (width, height, x, y)) Username=StringVar() Password=StringVar() login_1=Label(root2, text="Log In",fg="#CE9141",bg="#220047",width=20,font=("georgia", 40)) login_1.place(x=-50,y=20) user2= Label(root2, text="Username",fg="#CE9141",bg="#220047",width=20,font=("georgia", 15)) user2.place(x=-10,y=115) input3=Entry(root2,textvar=Username,width=40) input3.place(x=200,y=120) pass2= Label(root2, text="Password",fg="#CE9141",bg="#220047",width=20,font=("georgia", 15)) pass2.place(x=-10,y=165) input4=Entry(root2,textvar=Password,width=40,show="**") input4.place(x=200,y=170) submit1=Button(root2,text='Submit',font=("georgia",20),width=10,fg='#220047',bg='#CE9141',activeforeground="#CE9141",activebackground="#220047",height=1,) submit1.place(x=170,y=225) submit1.bind("<Button-1>",checkdata1) back=Button(root2,text="Back",font=("georgia",10),width=10,fg='#220047',bg='#CE9141',activeforeground="#CE9141",activebackground="#220047") back.place(x=400,y=10) back.bind("<Button-1>",back2) root2.mainloop()
def mp3player(): global root5 global i global listofsongs global listofsongs2 global songlist global songname global m root5=Tk() root5.resizable(0,0) root5.title("MP3 Player") root5.config(bg="#220047") width=600 height=600 screen_width = root5.winfo_screenwidth() screen_height = root5.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root5.geometry('%dx%d+%d+%d' % (width, height, x, y)) filename = PhotoImage(file ="player.png") background_label = Label(image=filename) background_label.place(x=0, y=0, relwidth=1, relheight=1) listofsongs=[] listofsongs2=[] m=StringVar() i=0 addd=Button(root5,text="Play A Folder",bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141",font=("georgia",25)) addd.place(x=100,y=205) addd.bind("<Button>",directory) createplay=Button(root5,text="Create Playlist",bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141",font=("georgia",25)) createplay.place(x=100,y=285) createplay.bind("<Button>",createplaylist) importplay=Button(root5,text="Import Playlist",bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141",font=("georgia",25)) importplay.place(x=100,y=365) importplay.bind("<Button-1>",importplaylist) root5.mainloop()
def error1(): global root4 root4=Tk() root4.title("Error1") root4.resizable(0,0) root4.config(bg="#220047") width=500 height=250 screen_width = root4.winfo_screenwidth() screen_height = root4.winfo_screenheight() x = (screen_width/2) - (width/2) y = (screen_height/2) - (height/2) root4.geometry('%dx%d+%d+%d' % (width, height, x, y)) errortxt1=Label(root4,text="Error!",font=("georgia",30),bg="#220047",fg="#CE9141") errortxt1.place(x=195,y=10) errortxt2=Label(root4,text="The error has occurred due to one of the following reasons: ",font=("georgia",10),bg="#220047",fg="#CE9141") errortxt2.place(x=55,y=70) error1=Label(root4,text="(i) The Password and Username do not match please try again . ",font=("georgia",10),bg="#220047",fg="#CE9141") error1.place(x=50,y=100) error2=Label(root4,text="(ii) The username is not registered with us please register with us . ",font=("georgia",10),bg="#220047",fg="#CE9141") error2.place(x=50,y=120) bt1=Button(root4,text="Register",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt1.place(x=100,y=160) bt1.bind("<Button-1>",register1) bt2=Button(root4,text="Try Again",font=("georgia",20),bg="#CE9141",fg="#220047",activebackground="#220047",activeforeground="#CE9141") bt2.place(x=250,y=160) bt2.bind("<Button-1>",tryagain1) root4.mainloop()
import tkinter as tk from tkinter import RIGHT, TOP, CENTER, X from tkinter.filedialog import Button, Tk from tkinter import filedialog import vlc # Define root root = Tk() root.title("Music Player") # Set default label text label_text = tk.StringVar() label_text.set("") def pick_music(): global music_path, label_text # Get chosen files path music_path = filedialog.askopenfilename(filetypes=(("mp3 files", "*.mp3"), ("waw files", "*.waw"))) # Set music name label text label_text.set(music_path.split("/")[-1]) # Set button states to normal stop_music_button["state"] = "normal" pause_music_button["state"] = "normal" play_music_button["state"] = "normal" def play_music(): global p # If song playing try to stop
#This is where we lauch the file manager bar. def OpenFile(): name = askopenfilename(initialdir="C:/Users/", filetypes =(("Python File", "*.py"),("All Files","*.*")), title = "Choose a file.") print(name) #Using try in case user types in unknown file or closes without choosing a file. try: with open(name,'r', newline = '') as UseFile: print(UseFile.read()) except: print("No file exists") root.title( "File Opener") root.geometry('500x500') label =Label(root, text ="Chose a File!") label.pack() #Menu Bar menu = Menu(root) root.config(menu=menu) file = Menu(menu) file.add_command(label = 'Open', command = OpenFile) file.add_command(label = 'Exit', command = root.destroy) menu.add_cascade(label = 'File', menu = file)