Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

getting cursor position in py game

import pygame
cursor_position = pygame.mouse.get_pos()
#returns a tuple : (x, y) of cursor
print(cursor_position)
print(f'X pos of cursor is : {cursor_position[0]}')
print(f'Y pos of cursor is : {cursor_position[1]}')
Comment

PREVIOUS NEXT
Code Example
Python :: days of week 
Python :: python rotate pdf pages 
Python :: animations text terminal python 
Python :: pd.options.display.max_columns()pd.options.display.max_row() 
Python :: parse datetime python 
Python :: python find the key with max value 
Python :: remove extension from filename python 
Python :: spacy en_core_web_sm error 
Python :: how to add a image in tkinter 
Python :: pandas add index 
Python :: change column order dataframe python 
Python :: find rows not equal to nan pandas 
Python :: python count number of zeros in a column 
Python :: xlim python 
Python :: django register models 
Python :: python selenium run javascript 
Python :: how to change window size in kivy python 
Python :: python convert number to string with leading zeros 
Python :: python auto module installer 
Python :: wait function python 
Python :: reindex pandas dataframe from 0 
Python :: install python glob module in windows 
Python :: how to multiply in django template 
Python :: month from datetime pandas 
Python :: install googlesearch for python 
Python :: pygame change logo 
Python :: python add 1 to count 
Python :: open url python 
Python :: how to get a random element from an array in python 
Python :: record video with python 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =