def __init__(self, txt, fntsize=15, callback=None, **kwargs): img = TextLine(" " + txt + " ", fontsize=fntsize) w, h = img.get_size() pygame.draw.lines(img, (0, 0, 255), True, ((0, 0), (w - 1, 0), (w - 1, h - 1), (0, h - 1)), 1) ImgButton.__init__(self, img, callback, **kwargs)
def __init__(self, img, max, cur, psize=(108, 11), ppos=(14,4)): ImgButton.__init__(self, img, callback=self.clicked2) color = (20,200,20) bgcolor = (0,0,0) self.btn_left = pygame.Rect([(0,0), (11,19)]) self.btn_right = pygame.Rect([(125,0), (11,19)]) self.changed = 1 self.increased = 0 self.clicked2 = 0 self.linked = [] self.progress = ProgressBar(psize, color, bgcolor) self.progress.set_pos(ppos) self.poffset = 14 self.max = max self.cur = cur self.active = 1 self.full = False self.set_max(max) if max > 0: self.show_progress() else: self.progress.change(0.0) self.progress.draw(self) self.update_links() self.active = 0
def __init__(self, img1, img2, callback, **kwargs): img = pygame.Surface(img1.get_size()) ImgButton.__init__(self, img, callback, **kwargs) self.anim_timer = utils.Timer(20) self.images = [img1, img2] self.blit(img1, (0, 0)) self.cur_img = 0 self.anim_timer.counter = self.anim_timer.interval + 1
def __init__(self, img, callback, **kwargs): ImgButton.__init__(self, img, callback, **kwargs) self.bg_image = img.copy() self.text = "" self.hi_col = (81, 255, 168) self.lo_col = (0, 0, 0) self.bg_col = self.lo_col self.fontcolor = (255, 255, 255)
def __init__(self, size, text, bgcolor, callback, arg=None, font="small"): img = pygame.Surface(size) img.fill(bgcolor) self.bgcolor = bgcolor self.font = FONT[font] txt = self.font.print_line(text) pos = utils.center(txt.get_size(), size) img.blit(txt, pos) self.changed = 1 ImgButton.__init__(self, img, callback, arg)
def __init__(self, img, img2, callback, args=None, img3=None, \ img4=None, snd=None): ImgButton.__init__(self, img, callback, args) self.active = True self.image = img self.image2 = img2 self.cur_image = img self.changed = 0 self.clicksnd = snd if img3: self.image3 = img3 else: self.image3 = img if img4: self.image4 = img4 else: self.image4 = img
def __init__(self, size, txt, callback, **kwargs): img = pygame.Surface(size) ImgButton.__init__(self, img, callback, **kwargs) self.bg = img.copy() self.text = txt self.draw_text(txt)
def __init__(self, img, himg, simg, callback, **kwargs): ImgButton.__init__(self, img, callback, **kwargs) self.base_img = img #normal img self.high_img = himg #on hover self.sel_img = simg #when selected self.sel = False
def __init__(self, img, img2, callback, **kwargs): ImgButton.__init__(self, img.copy(), callback, **kwargs) self.img1 = img self.img2 = img2
def __init__(self, img, images, callback, **kwargs): ImgButton.__init__(self, img.copy(), callback, **kwargs) self.normal = img self.anim = FlipImg(images, interval=4)
def __init__(self, img1, img2, callback, **kwargs): ImgButton.__init__(self, img1, callback, **kwargs) self.set_colorkey((255, 0, 255)) self.fill((255, 0, 255)) self.img1 = img1 self.img2 = img2
def __init__(self, img, type, callback, arg): ImgButton.__init__(self, img, callback, arg) self.struct_type = type self.enabled = True
def __init__(self, img, callback): ImgButton.__init__(self, img, callback=self.clicked2) self.set_colorkey((255,0,255)) #self.hitmask = pygame.mask.from_surface(self) self.pos = (0,0)