Ejemplo n.º 1
0
 def draw(self):
     pos = _xy_from_align(self.text_align, self.size)
     self.fill(self.style.bg_color)
     self.text(self.label,
               xy=pos,
               color=self.style.statictext_color,
               align=self.text_align,
               font=self.style.statictext_font,
               font_size=self.style.statictext_font_size)
Ejemplo n.º 2
0
 def draw(self):
     pos = _xy_from_align(self.text_align, self.size)
     self.fill(self.style.bg_color)
     self.text(self.label,
               xy=pos,
               color=self.style.statictext_color,
               align=self.text_align,
               font=self.style.statictext_font,
               font_size=self.style.statictext_font_size)
Ejemplo n.º 3
0
 def draw_text(self, text):
     pos = _xy_from_align('left', self.size)
     pos = (pos[0] + 9, pos[1])
     self.text(text,
               xy=pos,
               color=self.style.textentry_text_color,
               align='left',
               font=self.style.textentry_text_font,
               font_size=self.style.textentry_text_size)
Ejemplo n.º 4
0
 def draw_text(self, text):
     pos = _xy_from_align("left", self.size)
     pos = (pos[0] + 9, pos[1])
     self.text(
         text,
         xy=pos,
         color=self.style.textentry_text_color,
         align="left",
         font=self.style.textentry_text_font,
         font_size=self.style.textentry_text_size,
     )
Ejemplo n.º 5
0
 def draw(self):
     self.fill(self.style.bg_color)
     self.fill(self.style.textentry_bg_color)
     pygame.draw.rect(self.surface,self.style.textentry_text_color,self.local_rect,1)
     pos = _xy_from_align('left', self.size)
     pos = (pos[0]+9,pos[1])
     self.offsets = self.text(self.string,
           xy=pos,
           color=self.style.textentry_text_color,
           align='left',
           font=self.style.textentry_text_font,
           font_size=self.style.textentry_text_size)    
     if self.cursor_pos:
         x = self.offsets[self.cursor_pos-1]+9
     else:
         x = 9
     y1 = (self.size[1] - self.style.textentry_text_size)//2
     y2 = (self.size[1] + self.style.textentry_text_size)//2
     pygame.draw.line(self.surface,self.style.textentry_text_color,(x,y1),(x,y2))
Ejemplo n.º 6
0
 def draw(self):
     self.fill(self.style.bg_color)
     self.fill(self.style.textentry_bg_color)
     pygame.draw.rect(self.surface, self.style.textentry_text_color,
                      self.local_rect, 1)
     pos = _xy_from_align('left', self.size)
     pos = (pos[0] + 9, pos[1])
     self.offsets = self.text(self.string,
                              xy=pos,
                              color=self.style.textentry_text_color,
                              align='left',
                              font=self.style.textentry_text_font,
                              font_size=self.style.textentry_text_size)
     if self.cursor_pos:
         x = self.offsets[self.cursor_pos - 1] + 9
     else:
         x = 9
     y1 = (self.size[1] - self.style.textentry_text_size) // 2
     y2 = (self.size[1] + self.style.textentry_text_size) // 2
     pygame.draw.line(self.surface, self.style.textentry_text_color,
                      (x, y1), (x, y2))
Ejemplo n.º 7
0
           parent=slider_panel,
           callback = lambda x: cb("Slider H",x))
gui.Slider((0,40),(30,180),align="topleft",
           parent=slider_panel,
           callback = lambda x: cb("Slider V",x),
           release_callback = lambda x: cb("Slider V Release",x))

#text panel
text_panel = gui.ScrollArea(canvas_size=(500,500),
                            style=gui.Style(bg_color="navy"),
                            **panel_layouts)
positions = ['topleft', 'left', 'bottomleft', 
             'top', 'center', 'bottom', 
             'topright', 'right', 'bottomright']
scrollarea = text_panel.scrolled_area
args = [{'xy':_xy_from_align(x,(500,500)),
         'size':(80,50),
         'align':x,
         'text_align':x,
         'label':x} for x in positions]
texts = [gui.StaticText(parent=scrollarea,**a) for a in args]

#button panel
no_cancel_style = gui.Style(button_cancel_on_leave=False)
button_panel = gui.ScrollArea(canvas_size=panel_layouts['size'],**panel_layouts)
button1 = gui.Button((0,0),(100,25),align="topleft",label="Button 1", 
                     parent = button_panel.scrolled_area, 
                     callback = lambda: cb("Button 1"), 
                     long_click_callback = lambda: cb("Button 1(long)"))
button2 = gui.Button((0,30),(100,25),align="topleft",label="image:player_play.png", 
                     parent = button_panel.scrolled_area, 
Ejemplo n.º 8
0
)
gui.Slider(
    (0, 40),
    (30, 180),
    align="topleft",
    parent=slider_panel,
    callback=lambda x: cb("Slider V", x),
    release_callback=lambda x: cb("Slider V Release", x),
)

# text panel
text_panel = gui.ScrollArea(canvas_size=(500, 500), style=gui.Style(bg_color="navy"), **panel_layouts)
positions = ["topleft", "left", "bottomleft", "top", "center", "bottom", "topright", "right", "bottomright"]
scrollarea = text_panel.scrolled_area
args = [
    {"xy": _xy_from_align(x, (500, 500)), "size": (80, 50), "align": x, "text_align": x, "label": x} for x in positions
]
texts = [gui.StaticText(parent=scrollarea, **a) for a in args]

# button panel
no_cancel_style = gui.Style(button_cancel_on_leave=False)
button_panel = gui.ScrollArea(canvas_size=panel_layouts["size"], **panel_layouts)
button1 = gui.Button(
    (0, 0),
    (100, 25),
    align="topleft",
    label="Button 1",
    parent=button_panel.scrolled_area,
    callback=lambda: cb("Button 1"),
    long_click_callback=lambda: cb("Button 1(long)"),
)