![](/img/trans.png)
[英]Is it possible and how to set the cursor in pygame? (Python)
[英]How to set the cursor to the text line in PyGame
我正在從事 PyGame 項目,目前正在研究輸入框。 現在,如果光標懸停在輸入框上,我需要將其更改為文本光標。 您在編輯 a.txt 文件時看到的那個。 現在,我正在使用 pygame.set_cursor,但它並沒有提供我想要的選項。 有誰知道這是怎么做到的嗎? 謝謝!
以下內容直接從 pygame.org 文檔復制而來,對我來說效果很好:
cursor = pygame.cursors.compile(pygame.cursors.textmarker_strings)
pygame.mouse.set_cursor((8, 16), (0, 0), *cursor)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.