pygame listbox

 1 # -*- coding:utf-8 -*-
 2 """
 3 作者:slj
 4 文件名称:list_box.py
 5 日期:2022年04月06日 10:58
 6 """
 7 
 8 import pygame
 9 
10 
11 pygame.init()
12 screen = pygame.display.set_mode((600, 800))
13 pygame.display.set_caption('list box')
14 screen.fill((200, 200, 200))
15 font = pygame.font.Font('font/HuaWenYuanTi-2.ttf', 16)
16 f1 = font.render('刻度线', False, (255, 0, 0))
17 running = True
18 
19 
20 box_size = (80, 100)
21 box_rect = pygame.Rect((200, 200), box_size)
22 box_surface = pygame.Surface(box_rect.size)
23 
24 while running:
25     for event in pygame.event.get():
26         if event.type == pygame.QUIT:
27             running = False
28     box = pygame.draw.rect(screen, (0, 200, 200), box_rect, width=2)
29     screen.blit(f1, (200, 200))
30     pygame.display.update()
31 
32 
33 pygame.quit()

 

posted @ 2022-04-12 12:01  聚集的流星  阅读(54)  评论(0编辑  收藏  举报