Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

mouse bottom in pygame

while...: #your loop
  
    button = pygame.Rect(cordX, cordY, width, height) #your bytton
    pygame.draw.rect(win, (0, 0, 0), button) #show button
    
     mx, my = pygame.mouse.get_pos() #mouse pos

	 if button.collidepoint((mx, my)): #cheak if mouse on button  
      	if pygame.mouse.get_pressed()[0]: #cheak if mouse is preesed
           # writh here what you want to happend
     pygame.display.update()
Comment

PREVIOUS NEXT
Code Example
Python :: add two datetime python 
Python :: pandas read from txt separtion 
Python :: create spark dataframe from pandas 
Python :: convert numpy array to tensor 
Python :: merge two Python dictionaries in a single expression 
Python :: python find in largest 3 numbers in an array 
Python :: concatenate dataframes pandas without duplicates 
Python :: random question generator python 
Python :: python returen Thread 
Python :: difference between generator and iterator in python 
Python :: python tkinter scrollbar widget 
Python :: unicodedecodeerror file read 
Python :: change python3 as default for mac 
Python :: datetime to int in pandas 
Python :: flask flash not working 
Python :: pandas count the number of unique values in a column 
Python :: endswith python 
Python :: python function to scale selected features in a dataframe pandas 
Python :: how to add two numbers in python 
Python :: pandas groupby apply list 
Python :: dataframe from dict 
Python :: generate list of consecutive numbers 
Python :: two for loops in list comprehension 
Python :: read files and write into another files python 
Python :: json python 
Python :: python copy deep arrays without reference 
Python :: union dataframe pyspark 
Python :: python read lines 
Python :: lexicographic order python 
Python :: the following packages have unmet dependencies python3-tornado 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =