-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathas.py
More file actions
51 lines (40 loc) · 1.24 KB
/
as.py
File metadata and controls
51 lines (40 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pygame
from pyc import *
import time
SIZE = width,height = 640,240
screen = pygame.display.set_mode(SIZE)
screen.fill(C1_BLUE)
pygame.init()
# Text Editing
text1 = 'Text Editing, 텍스트 편집하기'
font1 = pygame.font.Font('Maplestory Bold.ttf',35)
img1 = font1.render(text1,True,BLACK)
rect1 = img1.get_rect()
rect1.topleft = (40,50)
cursor1 = pygame.Rect(rect1.topright,(3,rect1.height))
print(cursor1)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_BACKSPACE:
if len(text1)> 0:
text1 = text1[:-1]
print("x")
#elif event.key == pygame.K_g:
# print(chr(12622))
# text1 += chr(12622)
else:
text1 += event.unicode
print("o")
img1 = font1.render(text1,True,BLACK)
rect1.size = img1.get_size()
cursor1.topleft = rect1.topright
screen.fill(C1_BLUE)
screen.blit(img1,rect1)
if time.time() % 1 > 0.5:
pygame.draw.rect(screen, RED, cursor1)
pygame.display.update()
pygame.quit()