Step by Step Procedure to create Ghost Prank in Python
Hello friends how are you, Today in this post "Ghost Prank in Python" i am going to teach you how you can create a Ghost Prank in Python using few lines of code. If you want to create something interesting in programming using Python code then this post is for you. you can also surprise your friend by using this scary project
Now i am going to explain it step by step so just go through this post to understand this completely.
If you want to understand this through video then watch this video i have explained it step by step live
Step 1: Install Python : Click here to watch a video on how to install python or Open any browser and type Download Python and click the first link you will get official website of python here you will get a Download button and after clicking on this button you will get exe of latest python version just install it into your system.
Step 2: Install Pycharm | Create Project | Install Library: Click here to watch a single video on How to install Pycharm | Create Project | Install Library or To install Pycharm IDE Open any browser and type Download Pycharm and click the first link you will get official website of Pycharm here you will get a black download button and after clicking on this button you will get an exe of Pycharm , just install it into your system. If you are facing problem to install then watch the above video i have explained step by step.
Step 3: Create Project : Open Pycharm click on File which is in top left of screen and select New Project. Then you will get a screen. Here first you need to select directory of your project and then type a name for your project like "GhostPrank" after directory name, and at last click the create button to create this project.
Step 4: Create Python file: To create a python file for coding in your project just right click on project name "GhostPrank" and select new and click on Python File , you will get popup screen in which you have to type a name like "Program" for python file and press enter, it will create a python file with name Program.py inside the project GhostPrank.
Step 5: Store image and Music files: Here in this program i am using two music files one(sound.mp3) for background and another(screaming.mp3) for ghost screaming. I am also using one image(ghost.jpg) for showing ghost here so first download the music that you want to play and an image that you want to display and then just place these music files and image inside the folder/project folder where python file exists.
#import libraries from pygame import mixer import pygame as pg import time #initialize pygame pg.init() #creating window window=pg.display.set_mode((0,0),pg.FULLSCREEN) #intializing mixer mixer.init() #load backgroung music mixer.music.load("sound.mp3") #play background music mixer.music.play() #sleep for 5 seconds time.sleep(5) #load ghost image img=pg.image.load("ghost.jpg") window.blit(img,(150,0)) #load screaming music mixer.music.load("screaming.mp3") #play screaming music mixer.music.play() pg.display.update() #sleep for 3 seconds time.sleep(3)
1 Comments
Do ghost prank by importing pyautogui module
ReplyDelete