Token.NumberToken

NumberToken

class miniworldmaker.tokens.number_token.NumberToken(*args, **kwargs)[source]

A number token shows a Number.

You have to set the size of the token with self.size() manually so that the complete text can be seen.

Parameters
  • position – Top-Left position of Number

  • number – The initial number

  • font-size – The size of the font (default: 80)

  • color – The color of the font (default: white)

Examples

>>> self.score = NumberToken(position = (0, 0), number=0)
Sets a new NumberToken to display the score.
>>> number = self.score.get_number()
Gets the number stored in the NumberToken
>>> self.score.set_number(3)
Sets the number stored in the NumberToken
get_number()int[source]
Returns

The current number

Examples

>>> number = self.number_token.get_number()
Gets the number stored in the NumberToken
inc()[source]

Increases the number by one

set_number(number)[source]

Sets the number

Parameters

number – The number which should be displayed

Examples

>>> self.number_token.set_number(3)
Sets the number stored in the NumberToken