コード例 #1
0
 def set_layout_data(self, position, slider_width):
     Slider.set_layout_data(self, position, slider_width)
     
     y_delta = self.center()[1] - self.percent_label.center()[1]
     x_delta = self.position[0] + self.width - self.percent_label.position[0]
     y_position = self.center()[1] - (.5 * self.percent_label.height)
     self.percent_label.shift(x_delta + 7, y_delta + 4)
コード例 #2
0
 def set_layout_data(self, position, slider_width, bar_height):
     slider_position = (
         self.title_label.position[0],
         self.title_label.position[1] + self.title_label.height + 5
     )
     Slider.set_layout_data(self, slider_position, slider_width, bar_height)
     
     y_delta = self.center()[1] - self.value_label.center()[1]
     x_delta = self.position[0] + self.width - self.value_label.position[0]
     y_position = self.center()[1] - (.5 * self.value_label.height)
     self.value_label.shift(x_delta + 10, y_delta + 4)
     
     self.set_dimensions()
コード例 #3
0
 def __init__(self, position, slider_width, title_text):
     Slider.__init__(self)
     self.title_label = button.Label(position, title_text, (255, 255, 255), 20)
     self.value_label = button.Label((0,0), '5', (255, 255, 255), 20)
     self.create_children()
     self.set_layout_data(
         position, 
         slider_width, 
         PlayerSettingControl.BAR_HEIGHT
     )
     
     self.set_scroll_percent(.5)
     
     self.add_child(self.title_label)
     self.add_child(self.value_label)
コード例 #4
0
 def __init__(self):
     Slider.__init__(self)
     self.percent_label = Label((0,0), '', (255, 255, 255), 30)
コード例 #5
0
 def draw_relative(self, surface, position):
     Slider.draw_relative(self, surface, position)
     self.percent_label.draw_relative(surface, position)
コード例 #6
0
 def draw(self, surface):
     Slider.draw(self, surface)
     self.percent_label.draw(surface)
コード例 #7
0
 def handle_events(self):
     Slider.handle_events(self)
     
     self.percent_label.set_text(str(int(100 * self.get_scroll_percent())) + '%')
コード例 #8
0
 def draw_relative(self, surface, position):
     Slider.draw_relative(self, surface, position)
     self.title_label.draw_relative(surface, position)
     self.value_label.draw_relative(surface, position)
コード例 #9
0
 def draw(self, surface):
     Slider.draw(self, surface)
     self.value_label.draw(surface)