Toolbar Widgets
Contents
Toolbar Widgets¶
ToolbarWidget¶
- class miniworldmaker.containers.widgets.Widget[source]¶
A Widget which can be placed in the Toolbar.
A widget can have ‘text’ and an ‘image’.
Public Data Attributes:
should text be aligned left, oder next to the image?
should text be aligned left, oder next to the image?
Top text_padding
should text be aligned left, oder next to the image?
Width of image.
Margin below widget
Margin above widget
left margin
right margin
Widget height
Widget width (read only value)
The text which is displayed on the widget.
Public Methods:
__init__
()get_local_pos
(position)on_setup
()Overwrite this method if you want to add custom setup-code
on_mouse_left
(mouse_pos)set_background_color
(value)- rtype:
ToolbarWidget
clear
()remove
()Removes the widget from toolbar
set_text
(text)Sets text of widget.
set_image
(_img_source)sets image of widget
set_border
([color, width])sets border of widget
__str__
()Return str(self).
register
(method)Used as decorator e.g.
Private Methods:
_repaint
()Repaints the widget.
- property dirty¶
- property img_width: float¶
Width of image. (Height will be autoset by padding-left, padding-top and padding.right)
- Return type:
- set_border(color=(0, 0, 0, 255), width=1)[source]¶
sets border of widget
- Parameters:
color (_type_) – _description_
width (_type_) – _description_
- set_image(_img_source)[source]¶
sets image of widget
- Parameters:
_img_source (str) – path to image or tuple with color
- property text_align¶
should text be aligned left, oder next to the image?
- property text_padding_left¶
should text be aligned left, oder next to the image?
- property text_padding_top_left¶
should text be aligned left, oder next to the image?
ToolbarLabel¶
- class miniworldmaker.containers.widgets.Label(text, img_path=None)[source]¶
Public Data Attributes:
Inherited from : py: class:Widget
text_align
should text be aligned left, oder next to the image?
text_padding_left
should text be aligned left, oder next to the image?
text_padding_top
Top text_padding
text_padding_top_left
should text be aligned left, oder next to the image?
img_width
Width of image.
margin_bottom
Margin below widget
margin_top
Margin above widget
margin_left
left margin
margin_right
right margin
height
Widget height
width
Widget width (read only value)
background_color
dirty
text
The text which is displayed on the widget.
Public Methods:
__init__
(text[, img_path])Inherited from : py: class:Widget
__init__
(text[, img_path])get_local_pos
(position)on_setup
()Overwrite this method if you want to add custom setup-code
on_mouse_left
(mouse_pos)set_background_color
(value)- rtype:
ToolbarWidget
clear
()remove
()Removes the widget from toolbar
set_text
(text)Sets text of widget.
set_image
(_img_source)sets image of widget
set_border
([color, width])sets border of widget
__str__
()Return str(self).
register
(method)Used as decorator e.g.
Private Methods:
Inherited from : py: class:Widget
_repaint
()Repaints the widget.