get screen size python
>>> import pyautogui
>>> width, height= pyautogui.size()
>>> print(width)
1366
>>> print(height)
768
get screen size python
>>> import pyautogui
>>> width, height= pyautogui.size()
>>> print(width)
1366
>>> print(height)
768
turn pixel on display screen python
# Used this for pygame project just for the entry
# turn a specific pixel into another colour on your self made game display
change_specific_pixel = game_Display.set_at((x, y), (255, 255, 255))
# coords RGB
# e.g. a random star background for a game
import random
starlist = []
for x in range(1, display_width + 1): # iterates all integers between 1 and max width
for y in range(1, display_height + 1): # ditto with max height
x = random.randint(1 display_width) # sets random integer to x
y = random.randint(1, display_height) # ditto to y
star = game_Display.set_at((x, y), (255,255,255)) # turns pixel on the position (by cord above) into white
starlist.append(star) # adds the star to the list above
if len(starlist) >= 30:
break # loop ends when 30 stars are saved in the list
#Note: every time the game gets started you'll get a new star formation
#Sensensven
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us