Posts

Showing posts from June, 2024

wallpaper changer.

               Welcome to wallpaper changer This is wallpaper changer using python. You need to install this module. ctypes  If you can use auto wallpaper change when you login Then follow this step otherwise skip 1. convert .py file -to- .exe file           then           .exe file     cut/copy  2. press win+R 3. write 'shell:startup'  (this folder path paste .exe file)     (this folder is auto run folder) # #copyright by pyproject lab # import ctypes import os import random # You need to install ctypes def set_wallpaper (image_path): ctypes.windll.user32.SystemParametersInfoW( 20 , 0 , image_path, 0x01 | 0x02 ) def get_random_wallpaper (folder_path): wallpapers = [os.path.join(folder_path, f) for f in os.listdir(folder_path) if f.endswith(( '.png' , '.jpg' , '.jpeg' , '.bmp' ))] if not wallpapers: raise V...

4 type of read file using python.

                      Welcome to file reader  This is file reader using python. # # copyright by pyprojectlab # # All text print file_open= open ( "file_path" , "r" ) print (file_open.read()) file_open.close() # Print line or lines which you want file_open= open ( "file_path" , "r" ) print (file_open.readline()) print (file_open.readline()) print (file_open.readline()) #or more you need file_open.close() # Print all lines file_open= open ( "file_path" , "r" ) print (file_open.readlines()) file_open.close() # Print all line and count file_open= open ( "file_path" , "r" ) print ( "Lines This is text" ) for x,i in enumerate (file_open): print ( f" { x } " ,i) file_open.close()

Find any color from image using python

          Welcome to color finder from image  This is color finder from image using python. You need to 2 modules 1. pandas 2. opencv-python This is colors.cvs file  click this How to use this visit my channel. YouTube link       Instagram link esc to end the task import pandas as pd import cv2 img_path = './colorpic.jpg' #paste you image location csv_path = './colors.csv' index = [ 'color' , 'color_name' , 'hex' , 'R' , 'G' , 'B' ] df = pd.read_csv(csv_path, names =index, header = None ) img = cv2.imread(img_path) img = cv2.resize(img, ( 800 , 600 )) clicked = False r = g = b = xpos = ypos = 0 def get_color_name (R, G, B): minimum = 10000 for i in range ( len (df)): d = abs (R - int (df.loc[i, 'R' ])) + abs (G - int (df.loc[i, 'G' ])) + abs (B - int (df.loc[i, 'B' ])) if d <= minimum: minimum = d cname...

BMI Calculator on website using python.

                W elcome to web BMI Calculator  This is BMI Calculator on the website using python. You need to only 1 module import. Package Name = pywebio # # copyright by pyprojectlab # from pywebio.input import * from pywebio.output import * class calculation: def BMIcalculator ( Height , Mass): for t1, t2 in [ ( 16 , "severely underweight" ), ( 18.5 , "underweight" ), ( 25 , "normal" ), ( 30 , "overweight" ), ( 35 , "moderately obese" ), ( float ( "inf" ), "severely obese" ), ]: if BMI <= t1: put_text( "Your BMI is" , BMI, "and the person is :" , t2) break class calculation: def BMIcalculator ( self , Height, Mass): BMI = (Mass) / (Height * Height) for t1, t2 in [ ( 16 , "severely underweight" ), ( 18.5...

Python Tkinter QR Code Generator

           Welcome to QR Code Generator This is QR Code Generator using python. You can need to 2 modules   qrcode , tkinker  # # copyright by pyprojectlab # import qrcode from tkinter import * from tkinter import filedialog import os def get_code (): data_var = data.get() save_as = name_to_save.get() if not data_var or not save_as: label.config( text = "Please fill in both fields" , bg = "yellow" ) return qr = qrcode.make( str (data_var)) base.loc = filedialog.askdirectory() print ( "Selected Directory:" , base.loc) # Debug print if base.loc: save_path = os.path.join(base.loc, f" { save_as } .png" ) print ( "Save Path:" , save_path) # Debug print try : qr.save(save_path) label.config( text = "Done" , bg = "green" ) except Exception as e: label.config( text = f"Error: { e } " , bg = "red...

Name rolling game using python with GUI.

             Welcome to name rolling game This is name rolling game using python with GUI. You just only need to need module and paste then run. import these module      tkinter , matplotlib , numpy , random  # # copyright by pyprojectlab # import tkinter as tk from tkinter import simpledialog, messagebox import matplotlib.pyplot as plt import numpy as np import random from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg class NameRollingGame(tk.Tk): def __init__ ( self ): super (). __init__ () self .title( "Name Rolling Game" ) self .geometry( "800x600" ) self .names = [] self .add_name_button = tk.Button( self , text = "Add Name" , command = self .add_name) self .add_name_button.pack( side =tk.LEFT, padx = 20 ) self .spin_button = tk.Button( self , text = "Spin" , command = self .spin_wheel) self .spin_button.pack( side =tk.RIGHT, padx = 20 ) se...