import pygame
import sys
pygame.init()
screen_width = 400
screen_height = 300
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Input Box Example")
white = (255, 255, 255)
black = (0, 0, 0)
font = pygame.font.Font(None, 32)
input_box = pygame.Rect(100, 100, 200, 32)
color_inactive = pygame.Color('lightskyblue3')
color_active = pygame.Color('dodgerblue2')
color = color_inactive
active = False
text = ''
cursor = "|"
cursor_visible = True
cursor_timer = 0.5
cursor_pos = len(text)
key_repeat_timer = 0.05
key_repeat_start = None
key_repeat_char = None
key_repeat_open = False
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type ==
Pygame输入框
最新推荐文章于 2024-05-30 11:43:13 发布