简体   繁体   中英

How to set the cursor to the text line in PyGame

I am working on a PyGame Project, and currently working on the inputboxes. Now, if the cursor is hovering over the inputbox, i need it to change to the text cursor. The one you see when editing a.txt file. Right now, i am using pygame.set_cursor, but that doesn't semm to have the option that i want. Does anyone know how to do that? Thanks!

The following, which is copied straight from pygame.org docs, works fine for me:

cursor = pygame.cursors.compile(pygame.cursors.textmarker_strings)
pygame.mouse.set_cursor((8, 16), (0, 0), *cursor)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM