simpleguics2pygame — control¶
simpleguics2pygame module: simpleguics2pygame/control.
Classes Control and TextAreaControl.
Piece of SimpleGUICS2Pygame. https://bitbucket.org/OPiMedia/simpleguics2pygame
license: | GPLv3 — Copyright (C) 2015-2016, 2020 Olivier Pirson |
---|---|
author: | Olivier Pirson — http://www.opimedia.be/ |
version: | November 29, 2020 |
-
class
SimpleGUICS2Pygame.simpleguics2pygame.control.
Control
(frame, text, button_handler=None, width=None)[source]¶ Control similar to SimpleGUI Control (button and label) of CodeSkulptor.
-
__init__
(frame, text, button_handler=None, width=None)[source]¶ Set a button (if button_handler is not None) or a label (if button_handler is None) in the control panel.
Don’t use directly, use Frame.add_button() or Frame.add_label().
Parameters: - frame – Frame
- text – str
- button_handler – None or (function () -> *)
- width – None or int
-
__weakref__
¶ list of weak references to the object (if defined)
pygame.Color of the background in the button.
Horizontal padding in the button.
Vertical padding in the button.
pygame.font.Font of text in the button.
pygame.Color of the background in the button when it has pressed.
pygame.Color of text in the button.
-
_draw
()[source]¶ Draw the control object in the control panel.
(Not available in SimpleGUI of CodeSkulptor.)
Draw the the control object as a button.
(Not available in SimpleGUI of CodeSkulptor.)
-
_draw_label
()[source]¶ Draw the the control object as a label.
(Not available in SimpleGUI of CodeSkulptor.)
-
_label_pygame_font
¶ pygame.font.Font of the label.
-
_label_text_pygame_color
¶ pygame.Color of the label.
Deal a click of left mouse button on the zone of this Control.
If pressed then select this Control, else unselect and run the button handler (if exist).
(Not available in SimpleGUI of CodeSkulptor.)
Parameters: pressed – bool
-
-
class
SimpleGUICS2Pygame.simpleguics2pygame.control.
TextAreaControl
(frame, label_text, input_handler, input_width)[source]¶ TextAreaControl similar to SimpleGUI TextAreaControl (input) of CodeSkulptor.
-
__init__
(frame, label_text, input_handler, input_width)[source]¶ Set a input box in the control panel.
Don’t use directly, use Frame.add_input().
Parameters: - frame – Frame
- label_text – str
- input_handler – function (str) -> *
- input_width – int or float
-
__weakref__
¶ list of weak references to the object (if defined)
-
_input_background_pygame_color
¶ pygame.Color of the background in the input box.
-
_input_mark_pygame_color
¶ pygame.Color of the end mark of text in the input box.
-
_input_padding_x
= 5¶ Horizontal padding in the input box.
-
_input_padding_y
= 3¶ Vertical padding in the input box.
-
_input_pygame_color
¶ pygame.Color of the text in the input box.
-
_input_pygame_font
¶ pygame.font.Font of the text in the input box.
-
_input_selected_background_pygame_color
¶ pygame.Color of the background in the input box when it has focus.
-
_key
(pygame_event)[source]¶ Deal key pressed when this TextAreaControl have focus.
(Not available in SimpleGUI of CodeSkulptor.)
Parameters: pygame_event – pygame.Event KEYDOWN or KEYUP
-
_label_pygame_font
¶ pygame.font.Font of the label of the input box.
-
_label_text_pygame_color
¶ pygame.Color of the label of the input box.
Deal a click of left mouse button on the zone of this TextAreaControl.
If pressed then give it the focus.
(Not available in SimpleGUI of CodeSkulptor.)
Parameters: pressed – bool
-
-
SimpleGUICS2Pygame.simpleguics2pygame.control.
__all__
= ('Control', 'TextAreaControl')¶ Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
[source]