4 from pygame.locals import *
9 class Keysym(widget.Widget):
10 """A keysym input. This is deprecated and is scheduled to be removed from PGU."""
14 def __init__(self,value=None,**params):
15 params.setdefault('cls','keysym')
16 widget.Widget.__init__(self,**params)
19 self.font = self.style.font
20 w,h = self.font.size("Right Super") #"Right Shift")
21 self.style.width,self.style.height = w,h
22 #self.rect.w=w+self.style.padding_left+self.style.padding_right
23 #self.rect.h=h+self.style.padding_top+self.style.padding_bottom
27 if e.type == FOCUS or e.type == BLUR: self.repaint()
28 elif e.type == KEYDOWN:
36 if self.container.myfocus is self: self.pcls = "focus"
40 r = pygame.rect.Rect(0,0,self.rect.w,self.rect.h)
41 #render_box(s,self.style.background,r)
42 if self.value == None: return
44 for p in pygame.key.name(self.value).split(): name += p.capitalize()+" "
45 #r.x = self.style.padding_left;
46 #r.y = self.style.padding_bottom;
47 s.blit(self.style.font.render(name, 1, self.style.color), r)