做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

Python中pygame的mouse鼠標事件用法實例

來源:懂視網 責編:小采 時間:2020-11-27 14:34:50
文檔

Python中pygame的mouse鼠標事件用法實例

Python中pygame的mouse鼠標事件用法實例:本文實例講述了Python中pygame的mouse鼠標事件用法。分享給大家供大家參考,具體如下: pygame.mouse提供了一些方法獲取鼠標設備當前的狀態 ''' pygame.mouse.get_pressed - get the state of the mouse buttons get th
推薦度:
導讀Python中pygame的mouse鼠標事件用法實例:本文實例講述了Python中pygame的mouse鼠標事件用法。分享給大家供大家參考,具體如下: pygame.mouse提供了一些方法獲取鼠標設備當前的狀態 ''' pygame.mouse.get_pressed - get the state of the mouse buttons get th
本文實例講述了Python中pygame的mouse鼠標事件用法。分享給大家供大家參考,具體如下:

pygame.mouse提供了一些方法獲取鼠標設備當前的狀態

'''
pygame.mouse.get_pressed - get the state of the mouse buttons get the state of the mouse buttons
pygame.mouse.get_pos - get the mouse cursor position get the mouse cursor position
pygame.mouse.get_rel - get the amount of mouse movement get the amount of mouse movement
pygame.mouse.set_pos - set the mouse cursor position set the mouse cursor position
pygame.mouse.set_visible - hide or show the mouse cursor hide or show the mouse cursor
pygame.mouse.get_focused - check if the display is receiving mouse input check if the display is receiving mouse input
pygame.mouse.set_cursor - set the image for the system mouse cursor set the image for the system mouse cursor
pygame.mouse.get_cursor - get the image for the system mouse cursor get the image for the system mouse cursor
'''

在下面的demo中,主要用到了:

pygame.mouse.get_pressed()

pygame.mouse.get_pos()

展示的效果:

游戲效果:

當鼠標經過窗口的時候,窗口背景顏色會隨著鼠標的移動而發生改變,當鼠標點擊窗口

會在控制臺打印出是鼠標的那個鍵被點擊了:左,右,滾輪

#pygame mouse
import os, pygame
from pygame.locals import *
from sys import exit
from random import *
__author__ = {'name' : 'Hongten',
 'mail' : 'hongtenzone@foxmail.com',
 'Version' : '1.0'}
if not pygame.font:print('Warning, Can not found font!')
pygame.init()
screen = pygame.display.set_mode((255, 255), 0, 32)
screen.fill((255,255,255))
font = pygame.font.Font('data\font\TORK____.ttf', 20)
text = font.render('Cliked Me please!!!', True, (34, 252, 43))
mouse_x, mouse_y = 0, 0
while 1:
 for event in pygame.event.get():
 if event.type == QUIT:
 exit()
 elif event.type == MOUSEBUTTONDOWN:
 pressed_array = pygame.mouse.get_pressed()
 for index in range(len(pressed_array)):
 if pressed_array[index]:
 if index == 0:
 print('Pressed LEFT Button!')
 elif index == 1:
 print('The mouse wheel Pressed!')
 elif index == 2:
 print('Pressed RIGHT Button!')
 elif event.type == MOUSEMOTION:
 #return the X and Y position of the mouse cursor
 pos = pygame.mouse.get_pos()
 mouse_x = pos[0]
 mouse_y = pos[1]
 screen.fill((mouse_x, mouse_y, 0)) 
 screen.blit(text, (40, 100))
 pygame.display.update()

希望本文所述對大家Python程序設計有所幫助。

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

Python中pygame的mouse鼠標事件用法實例

Python中pygame的mouse鼠標事件用法實例:本文實例講述了Python中pygame的mouse鼠標事件用法。分享給大家供大家參考,具體如下: pygame.mouse提供了一些方法獲取鼠標設備當前的狀態 ''' pygame.mouse.get_pressed - get the state of the mouse buttons get th
推薦度:
標簽: 實例 python pygame
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top 主站蜘蛛池模板: 刚察县| 淮滨县| 滦南县| 灵石县| 东明县| 宜丰县| 庆元县| 盐亭县| 平度市| 美姑县| 通州区| 安溪县| 花莲县| 大洼县| 淮北市| 来凤县| 富锦市| 政和县| 方正县| 惠安县| 昭平县| 镇远县| 泸水县| 岳普湖县| 黑河市| 屏南县| 乌兰察布市| 延寿县| 家居| 二连浩特市| 浑源县| 兴安盟| 旌德县| 政和县| 石柱| 陈巴尔虎旗| 卓资县| 大庆市| 永仁县| 罗甸县| 桃源县|