[Windows 11] Deleted member 12441283:
# Importing all the modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

import customtkinter

from threading import Thread

from tkinter import DISABLED, messagebox

import subprocess

import webbrowser

import requests

import wget

import os

import sys

os.chdir(sys._MEIPASS)

def dark():

if open("Data\\settings.txt","r").read()=="light":

f=open("Data\\settings.txt","r")

data=f.read()

data=data.replace("light","dark")

f.close()

f=open("Data\\settings.txt","w")

f.write(data)

f.close

global background,first_layer,second_layer,second_button_fg,second_button_hover_border,second_button_text_color

global primary_button_fg,primary_button_hover_border,primary_button_text_color,accept_button_fg,accept_button_hover_border,accept_button_text_color

global cancel_button_fg,cancel_button_hover_border,cancel_button_text_color,text,title

background="#121212"

first_layer="#1D1D1D"

second_layer="#2D2D2D"

second_button_fg="#3A2D49"

second_button_hover_border="#473a52"

second_button_text_color="#D4ACF6"

primary_button_fg="#3A2D49"

primary_button_hover_border="#473a52"

primary_button_text_color="#D4ACF6"

accept_button_fg="#2d4933"

accept_button_hover_border="#395c41"

accept_button_text_color="#acf6c6"

cancel_button_fg="#492d2d"

cancel_button_hover_border="#5c3939"

cancel_button_text_color="#f6acac"

text="#E3E3E3"

title="#a584c2"

def light():

if open("Data\\settings.txt","r").read()=="dark":

f=open("Data\\settings.txt","r")

data=f.read()

data=data.replace("dark","light")

f.close()

f=open("Data\\settings.txt","w")

f.write(data)

f.close

global background,first_layer,second_layer,second_button_fg,second_button_hover_border,second_button_text_color

global primary_button_fg,primary_button_hover_border,primary_button_text_color,accept_button_fg,accept_button_hover_border,accept_button_text_color

global cancel_button_fg,cancel_button_hover_border,cancel_button_text_color,text,title

background="#fffafa"

first_layer="#F6ECF5"

second_layer="#F3DDF2"

second_button_fg="#dd7973"

second_button_hover_border="#8c4d49"

second_button_text_color="#45302e"

primary_button_fg="#dd7973"

primary_button_hover_border="#8c4d49"

primary_button_text_color="#45302e"

accept_button_fg="#64a371"

accept_button_hover_border="#467550"

accept_button_text_color="#3d5742"

cancel_button_fg="#b56060"

cancel_button_hover_border="#8c4949"

cancel_button_text_color="#6e3c3c"

text="black"

title="#dd7973"

def dark_check():

if open("Data\\settings.txt","r").read()=="dark":

messagebox.showinfo("𝒊𝒏𝒇𝒐𝒓𝒎𝒂𝒕𝒊𝒐𝒏","This mode is already applied.")

elif open("Data\\settings.txt","r").read()=="light":

messagebox.showinfo("𝒊𝒏𝒇𝒐𝒓𝒎𝒂𝒕𝒊𝒐𝒏","Restart the app.")

def light_check():

if open("Data\\settings.txt","r").read()=="light":

messagebox.showinfo("𝒊𝒏𝒇𝒐𝒓𝒎𝒂𝒕𝒊𝒐𝒏","This mode is already applied.")

elif open("Data\\settings.txt","r").read()=="dark":

messagebox.showinfo("𝒊𝒏𝒇𝒐𝒓𝒎𝒂𝒕𝒊𝒐𝒏","Restart the app.")

if open("Data\\settings.txt","r").read()=="dark":

dark()

open("Data\\settings.txt","r").close()

elif open("Data\\settings.txt","r").read()=="light":

light()

open("Data\\settings.txt","r").close()

# Main window _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

root=customtkinter.CTk(fg_color=background)

root.title("𝑹𝑮𝑯 𝑶𝒑𝒕𝒊𝒎𝒊𝒛𝒆𝒓 𝟯.𝟯")

root.iconbitmap("Data\\ico.ico")

screen_width=root.winfo_screenwidth()

screen_height=root.winfo_screenheight()

WIDTH=1100

HEIGHT=600

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

root.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

root.minsize(1100,450)

root.grid_columnconfigure((0,1), weight=1)

root.grid_rowconfigure(0, weight=1)

# Secondary Windows _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

def code(name,label_num,button_num):

button="button"+button_num

status="label"+label_num

if button=="button0" or button=="button10":

globals()[button].configure(text="Running...",state=DISABLED)

else :

globals()[button].configure(state=DISABLED)

globals()[status].configure(text="Running...")

root.update()

sub=subprocess.Popen(f"Data\\{name}",shell=False, stderr=subprocess.PIPE,stdout=subprocess.PIPE)

sub.communicate()

if button=="button0" or button=="button10":

globals()[button].configure(text="Done.")

elif status=="label3":

globals()[status].configure(text="Done.\nReboot your device.")

messagebox.showinfo("𝑵𝒐𝒕𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏","You have to reboot your device in order for the changes to take effect.")

else:

globals()[status].configure(text="Done.")

clean=Thread(target=code,args=("test.bat","","0"))

advance_opt=Thread(target=code,args=("test.bat","","10"))

def prompt(info,title,system,num):

prompt=customtkinter.CTkToplevel(fg_color=first_layer)

prompt.title(title)

prompt.iconbitmap("Data\\ico.ico")

WIDTH=600

HEIGHT=195

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

prompt.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

prompt.transient(root)

prompt.minsize(WIDTH,HEIGHT)

prompt.maxsize(WIDTH,HEIGHT)

label0=customtkinter.CTkLabel(prompt,text=info,

text_color=text,text_font=("corbel bold",15))

label0.pack(padx=15,pady=15)

button01=customtkinter.CTkButton(prompt,text="Continue",command=lambda:[prompt.destroy(),process.start()],

fg_color=accept_button_fg,hover_color=accept_button_hover_border,border_width=1.5,border_color=accept_button_hover_border,

text_font=("corbel bold italic",15),text_color=accept_button_text_color)

button01.pack(pady=10)

button11=customtkinter.CTkButton(prompt,text="Cancel",command=prompt.destroy,fg_color=cancel_button_fg,

hover_color=cancel_button_hover_border,border_width=1.5,border_color=cancel_button_hover_border,text_font=("corbel bold italic",15),

text_color=cancel_button_text_color)

button11.pack(pady=10)

process=Thread(target=code,args=(system,num,num))

def credits():

credits=customtkinter.CTkToplevel(fg_color=first_layer)

credits.title("⁫⁫⁫⁫⁫𝑪𝒓𝒆𝒅𝒊𝒕𝒔")

credits.iconbitmap("Data\\ico.ico")

WIDTH=420

HEIGHT=180

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

credits.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

credits.transient(root)

credits.minsize(WIDTH,HEIGHT)

credits.maxsize(WIDTH,HEIGHT)

label0=customtkinter.CTkLabel(credits,text="This project has been made by :\n♥ Ŗayeɳ Ĝħanɱi ♥\n",text_color=text,text_font=("corbel bold",18))

label0.pack(pady=15,padx=15)

label1=customtkinter.CTkLabel(credits,text="If you want to contribute in this project contact me.",text_color=text,text_font=("corbel bold",13))

label1.pack(pady=15,padx=15)

def about():

about=customtkinter.CTkToplevel(fg_color=first_layer)

about.title("⁫⁫⁫⁫⁫𝑨𝒃𝒐𝒖𝒕")

about.iconbitmap("Data\\ico.ico")

WIDTH=680

HEIGHT=200

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

about.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

about.transient(root)

about.minsize(WIDTH,HEIGHT)

about.maxsize(WIDTH,HEIGHT)

label0=customtkinter.CTkLabel(about,

text="This is a Windows Optimizer made by • Ŗåyëɳ Ĝħänɱi • :\n► I've created this optimizer to fix what Microsoft won't, Windows."

"\nAs you know with every new version of Windows there is a big performance hit,\nespecially for those who are on low-end pcs."

f"\nSo RGH Optimizer is here to make it possible for you to use your low-end pc again,\nwith the latest versions of your Windows. ◄",

text_font=("corbel bold",13),text_color=text)

label0.pack(pady=20,padx=10,expand=True)

def report():

report=customtkinter.CTkToplevel(fg_color=first_layer)

report.title("𝑹𝒆𝒑𝒐𝒓𝒕")

WIDTH=450

HEIGHT=285

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

report.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

report.transient(root)

report.minsize(WIDTH,HEIGHT)

report.maxsize(WIDTH,HEIGHT)

report.iconbitmap("Data\\ico.ico")

label0=customtkinter.CTkLabel(report,text="Make sure that the problem is\nnot caused by your system"

"\nbefore reporting anything.",text_font=("corbel bold",18),text_color=text)

label0.pack(pady=15,padx=15)

label1=customtkinter.CTkLabel(report,text="Do you really want to continue ?",text_color=text,text_font=("corbel bold",19))

label1.pack(pady=10,padx=15)

button01=customtkinter.CTkButton(report,text="Continue",command=lambda:[report.destroy(),

webbrowser.open("https://github.com/RayenGhanmi/Windows-Optimizer-By-RGH/issues/new")],

fg_color=accept_button_fg,hover_color=accept_button_hover_border,border_width=1.5,border_color=accept_button_hover_border,

text_font=("corbel bold italic",15),text_color=accept_button_text_color)

button01.pack(pady=10)

button11=customtkinter.CTkButton(report,text="Cancel",command=report.destroy,fg_color=cancel_button_fg,

hover_color=cancel_button_hover_border,border_width=1.5,border_color=cancel_button_hover_border,text_font=("corbel bold italic",15),

text_color=cancel_button_text_color)

button11.pack(pady=10)

def contact():

contact=customtkinter.CTkToplevel(fg_color=first_layer)

contact.title("⁫⁫⁫⁫⁫𝑪𝒐𝒏𝒕𝒂𝒄𝒕")

contact.iconbitmap("Data\\ico.ico")

WIDTH=450

HEIGHT=255

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

contact.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

contact.transient(root)

contact.minsize(WIDTH,HEIGHT)

contact.maxsize(WIDTH,HEIGHT)

label0=customtkinter.CTkLabel(contact,text="This will redirect you to\nŖåyëɳ Ĝħänɱi's Facebook",text_color=text,

text_font=("corbel bold",18))

label0.pack(padx=10,pady=15)

label1=customtkinter.CTkLabel(contact,text="Do you really want to continue ?",text_color=text,text_font=("corbel bold",18))

label1.pack(pady=10)

button0=customtkinter.CTkButton(contact,text="Continue",command=lambda:[contact.destroy(),webbrowser.open("https://www.facebook.com/GhanmiRayen22")],

fg_color=accept_button_fg,hover_color=accept_button_hover_border,border_width=1.5,border_color=accept_button_hover_border,

text_font=("corbel bold italic",15),text_color=accept_button_text_color)

button0.pack(pady=10)

button1=customtkinter.CTkButton(contact,text="Cancel",command=contact.destroy,fg_color=cancel_button_fg,

hover_color=cancel_button_hover_border,border_width=1.5,border_color=cancel_button_hover_border,text_font=("corbel bold italic",15),

text_color=cancel_button_text_color)

button1.pack(pady=10)

def advanced():

advanced=customtkinter.CTkToplevel(fg_color=first_layer)

advanced.title("𝑨𝒅𝒗𝒂𝒏𝒄𝒆𝒅")

WIDTH=450

HEIGHT=350

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

advanced.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

advanced.transient(root)

advanced.iconbitmap("Data\\ico.ico")

advanced.minsize(WIDTH,HEIGHT)

advanced.maxsize(WIDTH,HEIGHT)

label0=customtkinter.CTkLabel(advanced,text="Warning:",text_color=text,text_font=("corbel bold",22))

label0.pack(pady=15)

label1=customtkinter.CTkLabel(advanced,text="♦ This is recommended for advanced users only !\n♦ This will apply a bunch of extra tweaks\n"

"that are not recommended for regular users.\n♦ Note that you can't revert this step!\n♦ You will also face some network connection\n"

"if you're using WIFI",text_font=("corbel bold",15),text_color=text)

label1.pack(pady=10)

button=customtkinter.CTkButton(advanced,text="Apply",command=lambda:[advanced.destroy(),advance_opt.start()],

fg_color=accept_button_fg,hover_color=accept_button_hover_border,border_width=1.5,border_color=accept_button_hover_border,

text_font=("corbel bold italic",15),text_color=accept_button_text_color)

button.pack(pady=10,padx=10)

button0=customtkinter.CTkButton(advanced,command=advanced.destroy,text="Cancel",text_font=("corbel bold italic",15),

fg_color=cancel_button_fg,hover_color=cancel_button_hover_border,border_width=1.5,border_color=cancel_button_hover_border,text_color=cancel_button_text_color)

button0.pack(pady=10,padx=10)

def check():

response=requests.get("https://api.github.com/repos/RayenGhanmi/Windows-Optimizer-By-RGH/releases/latest")

if (response.json()["name"])=="RGH Optimizer 3.3":

messagebox.showinfo("𝑼𝒑𝒅𝒂𝒕𝒆𝒔","You're running the latest version.")

else:

msg=messagebox.askquestion("𝑼𝒑𝒅𝒂𝒕𝒆𝒔","There is a newer version available. Do you want to Download it?")

if msg=="yes":

update.configure(text="Updating...",text_font=("corbel bold",11),state=DISABLED)

file_ver=response.json()["tag_name"]

url=str(f"https://github.com/RayenGhanmi/Windows-Optimizer-By-RGH/releases/download/{file_ver}/{file_ver}.zip")

wget.download(url, f"{os.path.expanduser('~')}\\Downloads\\{file_ver}.zip")

update_check=Thread(target=check)

def settings():

settings=customtkinter.CTkToplevel(fg_color=first_layer)

settings.title("𝑺𝒆𝒕𝒕𝒊𝒏𝒈𝒔")

WIDTH=400

HEIGHT=175

x=(screen_width/2)-(WIDTH/2)

y=(screen_height/2)-((50+HEIGHT)/2)

settings.geometry(f"{WIDTH}x{HEIGHT}+{int(x)}+{int(y)}")

settings.transient(root)

settings.iconbitmap("Data\\ico.ico")

settings.minsize(WIDTH,HEIGHT)

settings.maxsize(WIDTH,HEIGHT)

label0=customtkinter.CTkLabel(settings,text="Choose your color mode:",

text_color=text,text_font=("corbel bold",15))

label0.pack(padx=15,pady=15)

button=customtkinter.CTkButton(settings,text="Dark",command=lambda:[dark_check(),dark()],

fg_color=accept_button_fg,hover_color=accept_button_hover_border,border_width=1.5,border_color=accept_button_hover_border,

text_font=("corbel bold italic",15),text_color=accept_button_text_color)

button.pack(pady=10)

button1=customtkinter.CTkButton(settings,text="Light",command=lambda:[light_check(),light()],

fg_color=cancel_button_fg,hover_color=cancel_button_hover_border,border_width=1.5,border_color=cancel_button_hover_border,text_font=("corbel bold italic",15),

text_color=cancel_button_text_color)

button1.pack(pady=10)

# Left frame _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

frame_left = customtkinter.CTkFrame(master=root,corner_radius=5,fg_color=first_layer,border_width=1,border_color=second_layer)

frame_left.rowconfigure(7, weight=10)

frame_left.grid(row=0,column=0,sticky="nsw",pady=10,padx=10)

button4=customtkinter.CTkButton(frame_left,text="Report bug",command=report,text_font=("bahnschrift bold",15),

corner_radius=5,fg_color=second_button_fg,hover_color=second_button_hover_border,border_width=1.5,border_color=second_button_hover_border,

text_color=second_button_text_color)

button4.grid(row=0,padx=20,pady=20,sticky="nse")

button5=customtkinter.CTkButton(master=frame_left,text="Credits",command=credits,

text_font=("bahnschrift bold",15),corner_radius=5,fg_color=second_button_fg,hover_color=second_button_hover_border,border_width=1.5,

border_color=second_button_hover_border,text_color=second_button_text_color)

button5.grid(row=1,pady=20,padx=20,sticky="nse")

button6=customtkinter.CTkButton(frame_left,text="Contact",command=contact,fg_color=second_button_fg,

hover_color=second_button_hover_border,corner_radius=5,border_width=1.5,border_color=second_button_hover_border,text_font=("bahnschrift bold",15),

text_color=second_button_text_color)

button6.grid(row=2,pady=20,padx=20,sticky="nse")

button7=customtkinter.CTkButton(master=frame_left,text="About",command=about,text_font=("bahnschrift bold",15),corner_radius=5,

fg_color=second_button_fg,hover_color=second_button_hover_border,border_width=1.5,border_color=second_button_hover_border,text_color=second_button_text_color)

button7.grid(row=3,pady=20,padx=20,sticky="nse")

legal=customtkinter.CTkLabel(master=frame_left,text="© 2022 RayenGhanmi",text_color=text,text_font=("segoe ui bold",10))

legal.grid(row=10,padx=15,pady=20,sticky="nse")

button8=customtkinter.CTkButton(master=frame_left,text="Settings",command=settings,text_font=("bahnschrift bold",15),corner_radius=5,

fg_color=second_button_fg,hover_color=second_button_hover_border,border_width=1.5,border_color=second_button_hover_border,text_color=second_button_text_color)

button8.grid(row=9,padx=15,pady=0,sticky="nse")

# Right frame _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

frame_right = customtkinter.CTkFrame(master=root,corner_radius=5,fg_color=first_layer,border_width=1,border_color=second_layer)

frame_right.rowconfigure((0, 1, 2, 3, 4, 5), weight=5)

frame_right.rowconfigure(6, weight=10)

frame_right.columnconfigure((0, 1), weight=10)

frame_right.columnconfigure(2, weight=0)

frame_right.grid(row=0,column=1,sticky="nswe",padx=10,pady=10)

frame_middle_right=customtkinter.CTkFrame(master=frame_right,fg_color=background,border_width=1,border_color=second_layer)

frame_middle_right.rowconfigure((0, 1, 2, 3, 4, 5, 6), weight=10)

frame_middle_right.rowconfigure(7, weight=10)

frame_middle_right.grid(rowspan=7,column=2,sticky="nsw",padx=10,pady=10)

# Buttons _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

button0=customtkinter.CTkButton(master=frame_middle_right,text="Clean up",command=lambda:[clean.start()],

text_font=("bahnschrift bold",15),corner_radius=5,fg_color=second_button_fg,hover_color=second_button_hover_border,border_width=1.5,border_color=second_button_hover_border,

text_color=second_button_text_color)

button0.grid(row=0,padx=10,pady=0,sticky="we")

button1=customtkinter.CTkButton(master=frame_middle_right,text="Fix",command=lambda:[prompt(info="This will fix any problem that's present "

"in your system,\nso make sure to close any running application.",title="𝑭𝒊𝒙",system="test.bat",num="1")],

fg_color=primary_button_fg,hover_color=primary_button_hover_border,text_font=("bahnschrift bold",18),border_width=1.5,border_color=primary_button_hover_border,

text_color=primary_button_text_color)

button1.grid(row=4,padx=10,pady=25,sticky="we")

button2=customtkinter.CTkButton(master=frame_middle_right,text="Debloat",command=lambda:[prompt(info="All of the pre-installed apps on your "

"computer will be removed,\nso make sure to close any running application.",title="⁫⁫⁫⁫⁫𝑫𝒆𝒃𝒍𝒐𝒂𝒕",system="test.bat",num="2")],

fg_color=primary_button_fg,hover_color=primary_button_hover_border,text_font=("bahnschrift bold",18),border_width=1.5,border_color=primary_button_hover_border,

text_color=primary_button_text_color)

button2.grid(row=5,padx=10,pady=25,sticky="we")

button3=customtkinter.CTkButton(master=frame_middle_right,text="Optimize",command=lambda:[prompt(info="Your system will benefit from these "

"enhancements,\nso make sure to close any running application.",title="⁫⁫⁫⁫⁫⁫𝑶𝒑𝒕𝒊𝒎𝒊𝒛𝒆",system="test.bat",num="3")],

fg_color=primary_button_fg,hover_color=primary_button_hover_border,text_font=("bahnschrift bold",18),border_width=1.5,border_color=primary_button_hover_border,

text_color=primary_button_text_color)

button3.grid(row=6,padx=10,pady=25,sticky="we")

button10=customtkinter.CTkButton(master=frame_middle_right,text="Advanced",command=advanced,text_font=("bahnschrift bold",15),

corner_radius=5,fg_color=second_button_fg,hover_color=second_button_hover_border,border_width=1.5,border_color=second_button_hover_border,

text_color=second_button_text_color)

button10.grid(row=10,pady=20,padx=10,sticky="we")

# labels _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

title=customtkinter.CTkLabel(master=frame_right,text="RGH Optimizer 3.3",text_font=("Arial Black",45),text_color=title)

title.grid(row=0,column=1,padx=40,pady=20,sticky="we")

label1=customtkinter.CTkLabel(master=frame_right,text="♦ Fix : will fix any problem on your system .",

text_color=text,text_font=("corbel bold",15),fg_color=second_layer,corner_radius=5)

label1.grid(row=2,column=1,padx=10,pady=20)

label2=customtkinter.CTkLabel(master=frame_right,text="♦ Debloat : will remove all of the built-in apps.",

text_color=text,text_font=("corbel bold",15),fg_color=second_layer,corner_radius=5)

label2.grid(row=3,column=1,padx=10,pady=20)

label3=customtkinter.CTkLabel(master=frame_right,text="♦ Optimize : will apply some optimizations to your system .",

text_color=text,text_font=("corbel bold",15),fg_color=second_layer,corner_radius=5)

label3.grid(row=4,column=1,padx=10,pady=20)

update=customtkinter.CTkButton(master=frame_right,text="Check for updates",

text_color="#0062ff",text_font=("corbel",11,"underline"),border_color=first_layer,hover=False,

fg_color=first_layer,width=0,height=0,command=lambda:[update_check.start()])

update.grid(row=6,column=1,padx=10,pady=16)

root.mainloop()