- UI_BUTTON
- class UI_SURFBUTTON
- def _ _ init _ _ (self, promillex, promilley, promillewidth, promilleheight, proportions)
- def setMouseDownFunc(self, func, value)
- def setMouseUpFunc(self, func, value)
- def setPosition(self, promillex, promilley)
- def setSize(self, promillewidth, promilleheight)
- def setDefaultSurface(self, surf1)
- def setMouseOverSurface(self, surf2)
- def update(self, screen, deltatime, orientation)
- class UI_CIRCLEBUTTON
- def _ _ init _ _ (self, posx, posy, radius)
- def update(self, screen, deltatime)
- def setMouseDownFunc(self, func, value)
- def setMouseUpFunc(self, func, value)
- def setPromillePosition(self, promillex, promilley)
import over appdata/CodeLibs/UI/UI_BUTTON.py
An UI-library concerning buttons with images and circular buttons.
A button with two images (default and mouseover).
def _ _ init _ _ (self, promillex, promilley, promillewidth, promilleheight, proportions)
Constructor for the UI_SURFBUTTON.
- promillex, promilley: The position on the screen in promille. Default: 0
- promillewidth, promilleheight: The width and height of the button on the screen, in promille. Default: UI_BUTTON_STANDARD_SIZE
- proportions: Which parts of the screen to take for reference. Default: 0 (0 = w, h / 1 = h, h / -1 = w, w)
def setMouseDownFunc(self, func, value)
Set a function to be called and value to be given when the mouse is down over the button.
def setMouseUpFunc(self, func, value)
Set a function to be called and value to be given when the mouse was released over the button.
def setPosition(self, promillex, promilley)
Set the position of the button in promille of the screen size.
def setSize(self, promillewidth, promilleheight)
Set the size of the button in promille of the screen size.
def setDefaultSurface(self, surf1)
Set default pygame-surface (image) to be shown when nothing is over the button.
def setMouseOverSurface(self, surf2)
Set the pygame-surface (image) to be shown when the mouse is over the button.
def update(self, screen, deltatime, orientation)
Call this in your update call when you want to show and activate the button.
- screen: The pygame screen surface to draw on.
- deltatime: The deltatime to pass on, in fractures of a second.
- orientation: The screen orientation. (0-3)
A circular button to click on.
def _ _ init _ _ (self, posx, posy, radius)
The constructor of an UI_CIRCLEBUTTON
- posx, posy: The position of the circle button in pixels.
- radius: The radius of the circle button in pixels.
def update(self, screen, deltatime)
Call this in your update function if you want to show and activate this circlebutton.
- screen: The pygame screen surface to draw to.
- deltatime: The deltatime passed on in fractions of a second.
def setMouseDownFunc(self, func, value)
The function to call with the given value if the mouse is down over this button.
def setMouseUpFunc(self, func, value)
The function to call with the given value if the mouse is released over this button.
def setPromillePosition(self, promillex, promilley)
Set the position of this button in promille of the screen size.