Posts

Showing posts from January, 2024

Python Snake Game With Source code

Image
  Python Snake Game Source code import pygame pygame.init() import random import time import sys #Colors-- Blue=(9,14,217) White=(255,255,255) Black=(0,0,0) Green=(0,200,0) Light_Green=(0,255,0) Purple=(201,29,201) Yellow=(255,255,0) Red=(255,0,0) #Setup Screen-- wn=pygame.display.set_mode((820,440)) pygame.display.set_caption('SNAKE_GAME') clock=pygame.time.Clock() #Function For Length oF Snake-- #snk_list=[snk_x,snk_y] contain-- def plot_snk(wn,color,snk_list,snk_length,snk_breadth): for x,y in snk_list: # To join more rectangle with initial head's snake- pygame.draw.rect(wn,color,[x,y,snk_length,snk_breadth]) #Draw Rectangle #To Print Text In Screen- Font1=pygame.font.SysFont('italics',59) def text_screen1(text,color,x,y): text_screen=Font1.render(text,True,color) wn.blit(text_screen,[x,y]) #For Highscore_text-- Font2=pygame.font.SysFont(0,42) def text_screen2(text,color,x,y): text_screen=Font2.render(text,True,color) wn.blit(t

Building a Python Music Player

Image
 Music Player Source Code | Python | dragcoder Music_Player--- from tkinter import * from PIL import Image,ImageTk import os import time import tkinter.messagebox from tkinter import filedialog from pygame import mixer from mutagen.mp3 import MP3 #for song length,#pip install mutagen mixer.init() class musicplayer:     def __init__(self,Tk):         self.root=Tk         Title--         self.root.title('Music_Player')                 Width and Height--         self.root.geometry('700x400')                 resizable window off--         self.root.resizable(0,0)         Backgroundcolor--         self.root.configure(background='white')         openfile---         def Openfile():             global filename             filename=filedialog.askopenfilename()         Menu-         self.menubar=Menu(self.root)         self.root.configure(menu=self.menubar)                 submenu----         self.submenu=Menu(self.menubar,tearoff=0)         self.menubar.add_casca