码迷,mamicode.com
首页 > 其他好文 > 详细

pygame.mouse--鼠标

时间:2020-06-16 15:34:16      阅读:66      评论:0      收藏:0      [点我收藏+]

标签:int   方法   mouse   pygame   html   imp   ash   das   splay   

技术图片

pygame.mouse函数

pygame.mouse.get_pressed()  ——  获取鼠标按键的情况(是否被按下)

import pygame

pygame.init()
screen = pygame.display.set_mode((196, 100))
pygame.display.set_caption("pygame.mouse函数")

while True:
    event=pygame.event.wait()
    if event.type == pygame.QUIT:
        exit()
    b=pygame.mouse.get_pressed()   #获取鼠标按键的情况(是否被按下)
    #返回一个由布尔值组成的列表,代表所有鼠标按键被按下的情况。True意味着在调用此方法时该鼠标按键正被按下
    #(1, 0, 1)  表示左键和右键被按下
    #这条语句没有体现滚轮的滚动

    print(b)

    pygame.display.update()

 

pygame.mouse.get_pos()  ——  获取鼠标光标的位置

pygame.mouse.get_rel()  ——  获取鼠标一系列的活动

pygame.mouse.set_pos()  ——  设置鼠标光标的位置

pygame.mouse.set_visible()  ——  隐藏或显示鼠标光标

pygame.mouse.get_focused()  ——  检查程序界面是否获得鼠标焦点

pygame.mouse.set_cursor()  ——  设置鼠标光标在程序内的显示图像

pygame.mouse.get_cursor()  ——  获取鼠标光标在程序内的显示图像

 

 

 

技术图片

pygame.mouse--鼠标

标签:int   方法   mouse   pygame   html   imp   ash   das   splay   

原文地址:https://www.cnblogs.com/liming19680104/p/13140810.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!