Пример #1
0
	def makeSurface(self):
		Widget.makeSurface(self)
		self.surface.fill(self.borderColor)
		pygame.draw.rect(self.surface,
			self.bgColor,
			(self.borderWidth, self.borderWidth,
			self.width-2*self.borderWidth, self.height-2*self.borderWidth))
Пример #2
0
	def __init__(self, nbPos=1, x=0, y=0, w=20, h=90, parent=None):
		Widget.__init__(self, x, y, w, h, parent)
		#print "init scrollbar : %s, %s, %s, %s" % (self.x, self.y, self.w, self.h)
		self.currentPos = 0
		self.dragging = False
		self.setNbPos(nbPos)
		self.makeSurface()
Пример #3
0
    def __init__(
        self,
        text="OK",
        font=FONT,
        width=0,
        height=0,
        bgcolor=COLOR_BG,
        bordercolor=COLOR,
        hoverbordercolor=COLOR_HOVER,
        borderwidth=1,
        parent=None,
    ):

        # Frame.__init__(self, width, height, bgcolor, bordercolor, hoverbordercolor, borderwidth, parent)

        Widget.__init__(self, 0, 0, width, height, parent)

        self.setBGColor(bgcolor)
        self.setBorderColor(bordercolor)
        self.borderWidth = borderwidth

        self.baseText = text
        self.padding = 2
        self.font = font
        # self.has_focus = False
        self.setText(self.baseText)
Пример #4
0
	def __init__(self,
		text= "OK",
		font=FONT,
		width=0,
		height=0,
		color = COLOR,
		color_bg = COLOR_BG,
		color_hover = COLOR_HOVER,
		color_bg_hover = COLOR_BG_HOVER,
		borderwidth = 1,
		parent = None):
		
		Widget.__init__(self, 0, 0, width, height, parent)
		
		self.color = color
		self.color_bg = color_bg
		self.color_hover = color_hover
		self.color_bg_hover = color_bg_hover
		self.borderWidth = borderwidth
		
		self.baseText = text
		self.padding = 2
		self.font = font
		self.has_focus = False
		self.click = False
		
		self.setText("  " + self.baseText + "  ")
		self.makeSurface()
Пример #5
0
	def __init__(self, x, y, w, h, parent=None, gui=None):
		Widget.__init__(self, x, y, w, h, parent)
		self.gui = gui
		self.makeSurface()
		self.entry = TextEntry("", width = w, parent=self)
		self.scrollTextWindow = ScrollTextWindow(0, 0, w, h-20, parent=self)
		
		#print "created chatwindow, after init, w = %s, h = %s, x = %s, y = %s" % (self.w, self.h, self.x, self.y)
		self.entry.setPos(0, self.h-20)
Пример #6
0
	def __init__(self, x=0, y=0, parent=None, gui=None):
		Widget.__init__(self, x,y,19,19*6,parent)
		self.gui = gui
		self.open = False
		
		self.topButton = EmoteButton(0,x,y)
		self.buttons = []
		for i in range(len(EmoteDic)):
			b = EmoteButton(i, x, y+(i+1)*20)
			self.buttons.append(b)
Пример #7
0
	def __init__(self, x, y, h, nbPos=2, parent= None):
		w = 20
		Widget.__init__(self, x, y, w, h, parent)
		self.currentPos = 0
		self.nbPos=int(nbPos)
		self.posMax = self.nbPos-1
		
		self.buttonUp = ScrollButton(self.x, self.y, "up", parent)
		self.buttonDown = ScrollButton(self.x, self.y+self.h - 20, "down", parent)
		
		self.bar = VScrollBar(self.nbPos, self.x, self.y+20, self.w, self.h-40, parent)
		#print(Vscrollbuttons init : %s %s %s %s" % (x,y,w,h))
		self.makeSurface()
Пример #8
0
	def __init__(self, x=0, y=0, direction = "up", parent=None):
		Widget.__init__(self, x, y, 20,20, parent)
		self.func = None
		#self.makeSurface()
		#print("making button, direction = %s, parent = %s" % (direction, parent))
		self.surface = ImgDB["graphics/gui/guibase.png"].subsurface((1,1,20,20)).convert_alpha()
		self.surfaceHover = ImgDB["graphics/gui/guibase.png"].subsurface((22,1,20,20)).convert_alpha()
		if direction == "down":
			self.surface = pygame.transform.rotate(self.surface, 180)
			self.surfaceHover = pygame.transform.rotate(self.surfaceHover, 180)
		elif direction == "left":
			self.surface = pygame.transform.rotate(self.surface, 90)
			self.surfaceHover = pygame.transform.rotate(self.surfaceHover, 90)
		elif direction == "right":
			self.surface = pygame.transform.rotate(self.surface, 270)
			self.surfaceHover = pygame.transform.rotate(self.surfaceHover, 270)
Пример #9
0
	def __init__(self,
		width = 100,
		height = 20,
		bgcolor = COLOR_BG,
		bordercolor = COLOR,
		hoverbordercolor = COLOR_HOVER,
		borderwidth = 1,
		parent = None):
		
		Widget.__init__(self, 0, 0, width, height, parent)
		
		self.setBGColor(bgcolor)
		self.setBorderColor(bordercolor)
		self.borderWidth = borderwidth
		
		self.makeSurface()
Пример #10
0
	def __init__(self, x, y, w, h, parent=None):
		Widget.__init__(self,x,y,w,h,parent)
		#print "init scrolltextwindow : %s %s %s %s" % (self.x, self.y, self.w, self.h)
		
		self.bar = VScrollBar_buttons(x+w-20, y, h, 2, parent)
		self.currentPos = 0
		
		self.padding = 0
		self.lineStep = 14
		
		self.nbVisibleLines = self.h /self.lineStep
		#print("%s visible lines" % (self.nbVisibleLines))
		
		self.makeSurface()
		
		self.baseText = ""
		self.setText("Welcome.\n")
Пример #11
0
	def __init__(self, direction='horizontal', parent=None):
		Widget.__init__(self, 0, 0, 1, 1, parent)
		self.c = BaseLayouter.layoutercount
		BaseLayouter.layoutercount += 1
		self.direction = direction
		#print "layouter direction = %s" % (direction)
		#self.set_parent(parent)
		
		if parent:
			print "creating layouter with parent surface = %s" % (parent.surface)
			self.surface = parent.surface
		else:
			print "WARNING : BaseLayouter has no surface!!!"
			self.makeSurface()
		
		#self.makeSurface()
		self._widgets = []
Пример #12
0
	def __init__(self,
		x=0,
		y=0,
		width=0,
		height=0,
		imgPath= "OK",
		imgx=0,
		imgy=0,
		imghoverx=0,
		imghovery=0,
		parent = None):
		
		Widget.__init__(self, x, y, width, height, parent)
		
		self.has_focus = False
		self.click = False
		
		self.surface = ImgDB[imgPath].subsurface((imgx, imgy, self.w, self.h))
		self.surfaceHover = ImgDB[imgPath].subsurface((imghoverx, imghovery, self.w, self.h))
Пример #13
0
	def __init__(self, nb=0, x=0, y=0, parent=None):
		Widget.__init__(self, x, y, 19,19, parent)
		self.nb = nb
		self.surface = EmoteDic[self.nb]