Skip to content

Commit 6169478

Browse files
authored
Merge pull request #307 from ppizarror/docs-scrollarea-private
Docs scrollarea private
2 parents 6b506f2 + 1a7b735 commit 6169478

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3095
-2257
lines changed

docs/_source/add_sounds.rst

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Adding sounds
88
A sound engine can be created using the :py:class:`Sound` class. The sound engine
99
can be customized by setting a sound file to several sounds defined by a type.
1010

11-
For example, buttons or keys...
12-
1311
**Example:**
1412

1513
.. code-block:: python

docs/_source/add_widgets.rst

+79-75
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ Adding widgets
44
==============
55

66
For adding new widgets to the Menu you can create new instances of the respective
7-
widget class. Or you can use the :py:class:`pygame_menu._widgetmanager.WidgetManager` class stored in ``Menu.add``
8-
property. These methods configure the widget and add to the Menu in a simple way.
7+
widget class. Or you can use the :py:class:`pygame_menu._widgetmanager.WidgetManager`
8+
class stored in ``Menu.add`` property. These methods configure the widget and add
9+
to the Menu in a simple way.
910

1011

1112
Add a button
1213
------------
1314

14-
A button is a text that fire action when the user trigger it. An action
15-
is linked to a button by defining the `action` parameter with one of the
16-
three values:
15+
A button is a text that fire action when the user trigger it. An action is linked
16+
to a button by defining the `action` parameter with one of the three values:
1717

1818
- an other :py:class:`pygame_menu.menu.Menu`, in this case, it will be displayed
1919
when the button is triggered.
20-
- a python callable object (a function, a method, a class, ...)
21-
that will be called with the given arguments.
22-
- a specific event of :py:mod:`pygame_menu`. The possible events are
23-
the following:
20+
- a python callable object (a function, a method, a class, ...) that will be
21+
called with the given arguments.
22+
- a specific event of :py:mod:`pygame_menu`. The possible events are the
23+
following:
2424

2525
========================================== =====================================
2626
Event Description
@@ -43,13 +43,13 @@ three values:
4343
about_menu = pygame_menu.Menu(...)
4444
4545
def func(name):
46-
print('Hello world from', name) # name will be 'foo'
46+
print('Hello world from', name) # Name will be 'foo'
4747
48-
menu.add.button('Exec', func, 'foo', # Execute a function
48+
menu.add.button('Exec', func, 'foo', # Execute a function
4949
align=pygame_menu.locals.ALIGN_LEFT)
50-
menu.add.button(about_menu.get_title(), about_menu, # Open a sub-menu
50+
menu.add.button(about_menu.get_title(), about_menu, # Open a sub-menu
5151
shadow=True, shadow_color=(0, 0, 100))
52-
menu.add.button('Exit', pygame_menu.events.EXIT, # Link to exit action
52+
menu.add.button('Exit', pygame_menu.events.EXIT, # Link to exit action
5353
align=pygame_menu.locals.ALIGN_RIGHT)
5454
5555
.. automethod:: pygame_menu._widgetmanager.WidgetManager.button
@@ -58,10 +58,9 @@ three values:
5858
Add a choices list (selector)
5959
-----------------------------
6060

61-
A selector gives the possibility choose a value in a predefined list.
62-
An item of a selector is a tuple: the first element is the text
63-
displayed, the others are the arguments passed to the callbacks
64-
``onchange`` and ``onreturn``.
61+
A selector gives the possibility choose a value in a predefined list. An item of
62+
a selector is a tuple: the first element is the text displayed, the others are
63+
the arguments passed to the callbacks ``onchange`` and ``onreturn``.
6564

6665
**Example:**
6766

@@ -83,16 +82,16 @@ displayed, the others are the arguments passed to the callbacks
8382
widget.get_selection_effect().color = color
8483
8584
items = [('Default', (255, 255, 255)),
86-
('Black', (0, 0, 0)),
87-
('Blue', (0, 0, 255)),
88-
('Random', (-1, -1, -1))]
85+
('Black', (0, 0, 0)),
86+
('Blue', (0, 0, 255)),
87+
('Random', (-1, -1, -1))]
8988
selector = menu.add.selector(
90-
title='Current color: ',
91-
items=,
92-
onreturn=change_background_color, # user press "Return" button
89+
title='Current color:\t',
90+
items=items,
91+
onreturn=change_background_color, # User press "Return" button
9392
onchange=change_background_color # User changes value with left/right keys
9493
)
95-
selector.add_self_to_kwargs() # callbacks will receive widget as parameter
94+
selector.add_self_to_kwargs() # Callbacks will receive widget as parameter
9695
selector2 = menu.add.selector(
9796
title='New color:',
9897
items=items,
@@ -126,10 +125,9 @@ that retrieves the clock/date string from ``time.strftime``.
126125
Add a color entry
127126
-----------------
128127

129-
A color input is similar as a text input but with a limited choice of
130-
characters to enter a RGB value of HEX decimal one. There is also a
131-
area to show the current color. By default the RGB integers separator
132-
is a comma (``,``).
128+
A color input is similar as a text input but with a limited choice of characters
129+
to enter a RGB value of HEX decimal one. There is also a area to show the current
130+
color. By default the RGB integers separator is a comma (``,``).
133131

134132
**Example:**
135133

@@ -144,11 +142,14 @@ is a comma (``,``).
144142
def check_color(value):
145143
print('New color:', value)
146144
147-
menu.add.color_input('RGB color 1: ', color_type=pygame_menu.widgets.COLORINPUT_TYPE_RGB,
145+
menu.add.color_input('RGB color 1: ',
146+
color_type=pygame_menu.widgets.COLORINPUT_TYPE_RGB,
148147
default=(255, 0, 255), font_size=18)
149-
menu.add.color_input('RGB color 2: ', color_type=pygame_menu.widgets.COLORINPUT_TYPE_RGB,
148+
menu.add.color_input('RGB color 2: ',
149+
color_type=pygame_menu.widgets.COLORINPUT_TYPE_RGB,
150150
input_separator='-', font_size=18)
151-
menu.add.color_input('HEX color 3: ', color_type=pygame_menu.widgets.COLORINPUT_TYPE_HEX,
151+
menu.add.color_input('HEX color 3: ',
152+
color_type=pygame_menu.widgets.COLORINPUT_TYPE_HEX,
152153
default='#ffaa11', font_size=18)
153154
154155
.. automethod:: pygame_menu._widgetmanager.WidgetManager.color_input
@@ -157,10 +158,9 @@ is a comma (``,``).
157158
Add a drop selection
158159
--------------------
159160

160-
A drop selector gives the possibility choose a value in a predefined list.
161-
An item of a drop selector is a tuple: the first element is the text
162-
displayed, the others are the arguments passed to the callbacks
163-
``onchange`` and ``onreturn``.
161+
A drop selector gives the possibility choose a value in a predefined list. An item
162+
of a drop selector is a tuple: the first element is the text displayed, the others
163+
are the arguments passed to the callbacks ``onchange`` and ``onreturn``.
164164

165165
**Example:**
166166

@@ -182,7 +182,7 @@ displayed, the others are the arguments passed to the callbacks
182182
selector_sum = menu.add.dropselect(
183183
title='What is the value of π?',
184184
items=[('3 (Engineer)', 0),
185-
('3.141592653589793238462643383279502884197169399375105820974944592', 1),
185+
('3.1415926535897932384626433832795028841971693993751058209', 1),
186186
('4', 2),
187187
('I don\'t know what is π', 3)],
188188
font_size=16,
@@ -221,9 +221,8 @@ Add a drop selection multiple
221221
-----------------------------
222222

223223
A multiple drop selector gives the possibility choose a value in a predefined list.
224-
An item of a drop selector is a tuple: the first element is the text
225-
displayed, the others are the arguments passed to the callbacks
226-
``onchange`` and ``onreturn``.
224+
An item of a drop selector is a tuple: the first element is the text displayed,
225+
the others are the arguments passed to the callbacks ``onchange`` and ``onreturn``.
227226

228227
**Example:**
229228

@@ -256,9 +255,9 @@ displayed, the others are the arguments passed to the callbacks
256255
Add a frame
257256
-----------
258257

259-
Frame is a widget container, it can pack many widgets both horizontally
260-
or vertically. All widgets within a same Frame count as one widget position,
261-
so using Frames is useful when designing column/row layout. Frames can contain
258+
Frame is a widget container, it can pack many widgets both horizontally or
259+
vertically. All widgets within a same Frame count as one widget position, so
260+
using Frames is useful when designing column/row layout. Frames can contain
262261
widgets or even more frames.
263262

264263
There is two types of frames, horizontal (h) and vertical (v) ones. These change
@@ -282,18 +281,24 @@ the way the widgets are added to the frame (packed).
282281
283282
frame_title.pack(menu.add.label('Settings', padding=0), margin=(2, 2))
284283
frame_title.pack(
285-
menu.add.button('Close', pygame_menu.events.EXIT, padding=(0, 5), background_color=(100, 100, 100)),
284+
menu.add.button('Close', pygame_menu.events.EXIT, padding=(0, 5),
285+
background_color=(100, 100, 100)),
286286
align=pygame_menu.locals.ALIGN_RIGHT, margin=(2, 2))
287-
frame_content.pack(menu.add.label('Pick a number', font_color=(150, 150, 150)),
288-
align=pygame_menu.locals.ALIGN_CENTER)
287+
frame_content.pack(
288+
menu.add.label('Pick a number', font_color=(150, 150, 150)),
289+
align=pygame_menu.locals.ALIGN_CENTER)
289290
frame_numbers = menu.add.frame_h(250, 41, padding=0)
290291
frame_content.pack(frame_numbers)
291292
for i in range(9):
292-
frame_numbers.pack(menu.add.button(i, font_color=(5 * i, 11 * i, 13 * i), padding=(0, 5), font_size=30),
293-
align=pygame_menu.locals.ALIGN_CENTER)
293+
frame_numbers.pack(
294+
menu.add.button(i, font_color=(5 * i, 11 * i, 13 * i),
295+
padding=(0, 5), font_size=30),
296+
align=pygame_menu.locals.ALIGN_CENTER)
294297
frame_content.pack(menu.add.vertical_margin(15))
295-
frame_content.pack(menu.add.toggle_switch('Nice toggle', False, width=100, font_color=(150, 150, 150), padding=0),
296-
align=pygame_menu.locals.ALIGN_CENTER)
298+
frame_content.pack(
299+
menu.add.toggle_switch('Nice toggle', False, width=100,
300+
font_color=(150, 150, 150), padding=0),
301+
align=pygame_menu.locals.ALIGN_CENTER)
297302
298303
**Example:**
299304

@@ -305,7 +310,8 @@ the way the widgets are added to the frame (packed).
305310
306311
menu = pygame_menu.Menu(...)
307312
308-
frame = menu.add.frame_v(400, 800, background_color=(50, 50, 50), padding=0, max_width=300, max_height=100)
313+
frame = menu.add.frame_v(400, 800, background_color=(50, 50, 50), padding=0,
314+
max_width=300, max_height=100)
309315
frame.set_title('My Frame App', title_font_color='white', padding_inner=(2, 5))
310316
311317
frame.pack(menu.add.dropselect(
@@ -354,8 +360,8 @@ configured before the addition.
354360
Add a label
355361
-----------
356362

357-
A label is used to display a text. If the text is too large, it
358-
can be wrapped in order to fit the menu size.
363+
A label is used to display a text. If the text is too large, it can be wrapped in
364+
order to fit the menu size.
359365

360366
**Example:**
361367

@@ -367,10 +373,10 @@ can be wrapped in order to fit the menu size.
367373
368374
menu = pygame_menu.Menu(...)
369375
370-
HELP = "Press ESC to enable/disable Menu "\
371-
"Press ENTER to access a Sub-Menu or use an option "\
372-
"Press UP/DOWN to move through Menu "\
373-
"Press LEFT/RIGHT to move through Selectors."
376+
HELP = 'Press ESC to enable/disable Menu ' \
377+
'Press ENTER to access a Sub-Menu or use an option ' \
378+
'Press UP/DOWN to move through Menu ' \
379+
'Press LEFT/RIGHT to move through Selectors.'
374380
menu.add.label(HELP, max_char=-1, font_size=20)
375381
376382
.. automethod:: pygame_menu._widgetmanager.WidgetManager.label
@@ -379,8 +385,8 @@ can be wrapped in order to fit the menu size.
379385
Add a none widget
380386
-----------------
381387

382-
A none widget is used to fill column/row layout, store information
383-
or even add drawing callbacks for being executed on each menu draw.
388+
A none widget is used to fill column/row layout, store information or even add
389+
drawing callbacks for being executed on each menu draw.
384390

385391
.. code-block:: python
386392
@@ -394,8 +400,8 @@ or even add drawing callbacks for being executed on each menu draw.
394400
Add a surface
395401
-------------
396402

397-
A surface widget only accepts an external surface which is drawn on the Menu.
398-
The widget size is the same as the surface, considering also the margin and the padding.
403+
A surface widget only accepts an external surface which is drawn on the Menu. The
404+
widget size is the same as the surface, considering also the margin and the padding.
399405

400406
**Example:**
401407

@@ -420,10 +426,9 @@ The widget size is the same as the surface, considering also the margin and the
420426
Add a table
421427
-----------
422428

423-
A table is a frame which packs widgets in a structured way. Tables
424-
can contain a text, numbers, or even more widgets (Frames, Tables, Images, etc).
425-
All widgets are read-only, them do not accept any event, only scrollable frames
426-
work.
429+
A table is a frame which packs widgets in a structured way. Tables can contain a
430+
text, numbers, or even more widgets (Frames, Tables, Images, etc). All widgets are
431+
read-only, them do not accept any event, only scrollable frames work.
427432

428433
**Example:**
429434

@@ -485,9 +490,9 @@ and a widget (Image):
485490
Add a text entry
486491
----------------
487492

488-
A text input permits to enter a string using a keyboard. Restriction
489-
on entered characters can be set using ``input_type``, ``maxchar``,
490-
``maxwidth`` and ``valid_chars`` parameters.
493+
A text input permits to enter a string using a keyboard. Restriction on entered
494+
characters can be set using ``input_type``, ``maxchar``, ``maxwidth`` and
495+
``valid_chars`` parameters.
491496

492497
**Example:**
493498

@@ -512,8 +517,8 @@ on entered characters can be set using ``input_type``, ``maxchar``,
512517
Add a toggle switch
513518
-------------------
514519

515-
A fully customizable switch between two states (``On``, ``Off``). If
516-
you need more options, take a look at the ``ToggleSwitch`` widget class.
520+
A fully customizable switch between two states (``On``, ``Off``). If you need
521+
more options, take a look at the ``ToggleSwitch`` widget class.
517522

518523
**Example:**
519524

@@ -535,8 +540,8 @@ you need more options, take a look at the ``ToggleSwitch`` widget class.
535540
Add a vertical spacer
536541
---------------------
537542

538-
A vertical spacer can be added between two widgets to have a better
539-
visual rendering of the menu.
543+
A vertical spacer can be added between two widgets to have a better visual
544+
rendering of the menu.
540545

541546
**Example:**
542547

@@ -580,10 +585,9 @@ Adds a clickable url link.
580585
Add an image
581586
------------
582587

583-
An image can be displayed on a menu.
584-
The ``scale`` parameter represent the scaling ratio of the image width
585-
and height. When ``scale_smooth=True``, the rendering is better but it
586-
requires more CPU resources.
588+
An image can be displayed on a menu. The ``scale`` parameter represent the
589+
scaling ratio of the image width and height. When ``scale_smooth=True``, the
590+
rendering is better but it requires more CPU resources.
587591

588592
**Example:**
589593

0 commit comments

Comments
 (0)