PET STIMULATOR
Jhanavi. M
11 A1
Jhanavi. M
1443
Jhanavi. M
1443
20/2/23
Have you ever thought about how to make
apps like the talking cat and other types of
screen pets? Guess what, with the help of
Python we can create our screen pets that
can change their emotions with every click.
In this article, I’ll walk you through how to
create your screen pet with Python.
To create a pet stimulator with Python, we
need to know what it is and what it does.
When you launch the program, the Screen
Pet will be sitting there, with a small smile
on its face and blinking. We’ll code our
program to change the onscreen animal’s
expressions from normal to happy, cheeky,
or sad, depending on how you interact with
it onscreen.
A virtual pet game refers to a video game of
a pet-raising simulation. Featured gameplay
of these games focuses on the care,
raising, breeding of virtual pets. The
rst widely popular virtual pet game is
Petz, a series of single-player video games
where users can adopt, raise, care for and
breed their own pets.
Kids will enjoy these kinds of pet
stimulation games because of the cute
pet pictures appeared in the game.
Pet stimulator is the most popular game all
over the world.
fi
Operating system
• Windows 10 or 11 64-bit (Pro edition is preferred)
• Windows 10 S is not supported due to restricted functionality
• Windows must have the latest updates installed
Memory
Minimum 16GB RAM, Recommended 32GB RAM
Graphics card
NVIDIA GeForce RTX 3060 or better (AMD and Intel GPUs are
not acceptable alternatives)
Virus protection
Windows Defender is included with Windows 10 for free.
CPU: P4/AMD 3GHz or Intel Core 2 Duo 2GHz+
CPU SPEED: Info
RAM: 2 GB
OS: Windows 7 or Windows 8
FREE DISK SPACE: 40 GB
SOUND CARD: Yes
MONITOR MAXIMUM RESOLUTION: Monitor capable of displaying
resolution of 1,280 x768 or higher
DVD-ROM: Yes
To create a screen pet with Python, we need to know
what it is and what it does. When you launch the
program, the Screen Pet will be sitting there, with a
small smile on its face and blinking. We’ll code our
program to change the onscreen animal’s expressions
from normal to happy, cheeky, or sad, depending on
how you interact with it onscreen.
Below are the three features that our screen pet will
perform:
1. Happy Face: When you will click on it with the
mouse the screen pet will blush and it will look
happy.
2. Cheeky Face: If you will double click it, then it will
show its tongue to you.
3. Sad Face: If you will ignore it then it will become
sad and the point where you click then it will
become happy again.
Screen Pet game is an event-based program, which
means the functions it performs and the order in
which it performs all functions is dependent on user
input. In such programs, user input can take any form,
such as keypresses and mouse clicks.
from tkinter import HIDDEN, NORMAL, Tk, def toggle_pupils():
Canvas
if not c.eyes_crossed:
def toggle_eyes():
c.move(pupil_left, 10, -5)
current_color = c.itemcget(eye_left, ' ll')
c.move(pupil_right, -10, -5)
new_color = c.body_color if current_color
== 'white' else 'white' c.eyes_crossed = True
current_state = c.itemcget(pupil_left, else:
'state')
c.move(pupil_left, -10, 5)
new_state = NORMAL if current_state ==
HIDDEN else HIDDEN c.move(pupil_right, 10, 5)
c.itemcon gure(pupil_left, c.eyes_crossed = False
state=new_state)
c.itemcon gure(pupil_right,
state=new_state)
c.itemcon gure(eye_left, ll=new_color)
c.itemcon gure(eye_right, ll=new_color)
def blink():
toggle_eyes()
root.after(250, toggle_eyes)
root.after(3000, blink)
fi
fi
fi
fi
fi
fi
fi
def toggle_tongue():
def show_happy(event):
if not c.tongue_out:
if (20 <= event.x and event.x <= 350) and
c.itemcon gure(tongue_tip, (20 <= event.y and event.y <= 350):
state=NORMAL)
c.itemcon gure(cheek_left,
c.itemcon gure(tongue_main, state=NORMAL)
state=NORMAL)
c.itemcon gure(cheek_right,
c.tongue_out = True state=NORMAL)
else: c.itemcon gure(mouth_happy,
state=NORMAL)
c.itemcon gure(tongue_tip,
state=HIDDEN) c.itemcon gure(mouth_normal,
state=HIDDEN)
c.itemcon gure(tongue_main,
state=HIDDEN) c.itemcon gure(mouth_sad,
state=HIDDEN)
c.tongue_out = False
c.happy_level = 10
def cheeky(event):
return
toggle_tongue()
toggle_pupils() def hide_happy(event):
hide_happy(event) c.itemcon gure(cheek_left,
state=HIDDEN)
root.after(1000, toggle_tongue)
c.itemcon gure(cheek_right,
root.after(1000, toggle_pupils) state=HIDDEN)
return c.itemcon gure(mouth_happy,
state=HIDDEN)
c.itemcon gure(mouth_normal,
state=NORMAL)
c.itemcon gure(mouth_sad,
state=HIDDEN)
return
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
def sad():
eye_left = c.create_oval(130, 110, 160, 170,
outline='black', ll='white')
if c.happy_level == 0:
pupil_left = c.create_oval(140, 145, 150, 155,
c.itemcon gure(mouth_happy,
outline='black', ll='black')
state=HIDDEN)
eye_right = c.create_oval(230, 110, 260, 170,
c.itemcon gure(mouth_normal,
outline='black', ll='white')
state=HIDDEN)
pupil_right = c.create_oval(240, 145, 250,
c.itemcon gure(mouth_sad,
155, outline='black', ll='black')
state=NORMAL)
else:
c.happy_level -= 1
mouth_normal = c.create_line(170, 250, 200,
root.after(5000, sad) 272, 230, 250, smooth=1, width=2,
state=NORMAL)
root = Tk() mouth_happy = c.create_line(170, 250, 200,
282, 230, 250, smooth=1, width=2,
c = Canvas(root, width=400, height=400) state=HIDDEN)
c.con gure(bg='dark blue', mouth_sad = c.create_line(170, 250, 200,
highlightthickness=0) 232, 230, 250, smooth=1, width=2,
state=HIDDEN)
c.body_color = 'SkyBlue1'
tongue_main = c.create_rectangle(170, 250,
230, 290, outline='red', ll='red',
state=HIDDEN)
body = c.create_oval(35, 20, 365, 350, tongue_tip = c.create_oval(170, 285, 230,
outline=c.body_color, ll=c.body_color) 300, outline='red', ll='red', state=HIDDEN)
ear_left = c.create_polygon(75, 80, 75, 10,
165, 70, outline=c.body_color,
ll=c.body_color)
cheek_left = c.create_oval(70, 180, 120, 230,
outline='pink', ll='pink', state=HIDDEN)
ear_right = c.create_polygon(255, 45, 325,
10, 320, 70, outline=c.body_color,
cheek_right = c.create_oval(280, 180, 330,
ll=c.body_color)
230, outline='pink', ll='pink', state=HIDDEN)
foot_left = c.create_oval(65, 320, 145, 360,
outline=c.body_color, ll=c.body_color)
foot_right = c.create_oval(250, 320, 330,
360, outline=c.body_color, ll=c.body_color)
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
c.pack()
c.bind('<Motion>', show_happy)
c.bind('<Leave>', hide_happy)
c.bind('<Double-1>', cheeky)
c.happy_level = 10
c.eyes_crossed = False
c.tongue_out = False
root.after(1000, blink)
root.after(5000, sad)
root.mainloop()
We have successfully created a python pet
stimulator game using graphical user
interface (GUI). Now we can play the pet
stimulator game which we have created.
https://dev.to/unitybuddy/5-python-games-with-
source-code-3g2b
https://core.ac.uk/download/pdf/160755262.pdf
https://www.systemrequirementslab.com/cyri/
requirements/game-software/11544
https://itsc.ontariotechu.ca/tele/business-and-it/
fbit-specs_game-development.php