Skip to content

Commit 2863170

Browse files
authored
Fix GUI example docstrings (#1758)
* Correct anchor layout example's docstring header * Add a compliant docstring to box_layout example * Add compliant top-level docstring to button_with_text gui example * Add top-level docstring with run command to dropdown gui example * Add top-level docstring with run command to grid_layout gui example * Rename password field example file * Add a top-level docstring with run command to hidden password example * Add top-level docstring with run command to ninepatch gui example * Add top-level docstring for scroll_area example * Add top-level docstring to side_bars_with_box_layout example * Add top-level docstring to size hint gui example * Add top-level docstring to the stats_topleft gui example * Add top-level docstring to style_v2 example * Add top-level docstring to textured_slider gui example & touch up internal subclass * Add top-ldevl docstring to toggle gui example * Add a top-level docstring to widget_gallery gui example
1 parent 346efb5 commit 2863170

15 files changed

+160
-14
lines changed

arcade/gui/examples/anchor_layout.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
"""
2-
Example shows how to use UIAnchorWidget to position widgets on screen.
3-
Dummy widgets indicate hovered, pressed and clicked.
2+
Positioning UI elements with UIAnchorLayout
3+
4+
UIAnchorLayout aligns widgets added to it to directional anchors, which
5+
include "left", "center_x", or "top". Dummy widgets react to click events
6+
by changing color.
7+
8+
If arcade and Python are properly installed, you can run this example with:
9+
python -m arcade.gui.examples.anchor_layout
410
"""
511

612
import arcade

arcade/gui/examples/box_layout.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""
2+
Arrange widgets in vertical or horizontal lines with UIBoxLayout
3+
4+
The direction UIBoxLayout follows is controlled by the `vertical` keyword
5+
argument. It is True by default. Pass False to it to arrange elements in
6+
a horizontal line.
7+
8+
If arcade and Python are properly installed, you can run this example with:
9+
python -m arcade.gui.examples.box_layout
10+
"""
111
import arcade
212
from arcade.gui import UIManager, UIBoxLayout
313
from arcade.gui.widgets import UIDummy, UISpace

arcade/gui/examples/button_with_text.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""
2+
Customizing buttons with text & textures.
3+
4+
This example showcases arcade's range of different built-in button types
5+
and how they can be used to customize a UI. A UIGridLayout is used to
6+
arrange buttons.
7+
8+
If arcade and Python are properly installed, you can run this example with:
9+
python -m arcade.gui.examples.button_with_text
10+
"""
111
import arcade
212
from arcade import load_texture
313
from arcade.gui import UIManager, UIImage

arcade/gui/examples/dropdown.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
Creating a dropdown menu with UIDropDown
3+
4+
When an option in the UIDropDown is chosen, this example will respond
5+
by changing the text displayed on screen to reflect it.
6+
7+
If arcade and Python are properly installed, you can run this example with:
8+
python -m arcade.gui.examples.dropdown
9+
"""
110
import arcade
211
from arcade.gui import UIManager, UILabel, UIOnChangeEvent
312
from arcade.gui.widgets.dropdown import UIDropdown

arcade/gui/examples/grid_layout.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""
2+
Arrange elements in line with grid tiles with UIGridLayout
3+
4+
UIGridLayout allows you to place elements to cover one or more
5+
cells of a grid. To assign an element more than one grid square,
6+
use the col_span and row_span keyword arguments.
7+
8+
If arcade and Python are properly installed, you can run this example with:
9+
python -m arcade.gui.examples.grid_layout
10+
"""
111
import arcade
212
from arcade.gui import UIManager
313
from arcade.gui.widgets import UIDummy

arcade/gui/examples/login_mask.py renamed to arcade/gui/examples/hidden_password.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""
2+
Creating a hidden password field
3+
4+
This example demonstrates how to create a custom text input
5+
which hides the contents behind a custom character, as often
6+
required for login screens
7+
8+
If arcade and Python are properly installed, you can run this example with:
9+
python -m arcade.gui.examples.hidden_password
10+
"""
111
from typing import Optional
212

313
import arcade

arcade/gui/examples/ninepatch.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""
2+
Create custom scalable UI themes with NinePatchTexture
3+
4+
Nine-patch textures are a technique for scalable custom borders and
5+
frames for UI elements. Widgets which support a background texture can
6+
also use a NinePatchTexture to support scaling where the corners stay the
7+
same, like a window.
8+
9+
If arcade and Python are properly installed, you can run this example with:
10+
python -m arcade.gui.examples.ninepatch
11+
"""
112
import arcade
213
from arcade import load_texture
314
from arcade.gui import UIManager, UIAnchorLayout, UIWidget, NinePatchTexture

arcade/gui/examples/scroll_area.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
"""
2-
This example is a POC for a UIScrollArea.
2+
This example is a proof-of-concept for a UIScrollArea.
33
4-
You can move the UIScrollArea using the mouse wheel or draging it with the middle mouse button
4+
You can currently scroll through the UIScrollArea in the following ways:
55
6-
Missing:
7-
- Thoughtful API
8-
- UIScrollBars
9-
"""
6+
* scrolling the mouse wheel
7+
* dragging with middle mouse button
8+
9+
It currently needs the following improvements:
1010
11+
* A better API, including scroll direction control
12+
* UIScrollBars
13+
14+
If arcade and Python are properly installed, you can run this example with:
15+
python -m arcade.gui.examples.scroll_area
16+
"""
1117
from typing import Iterable, Optional
1218

1319
from pyglet.event import EVENT_UNHANDLED

arcade/gui/examples/side_bars_with_box_layout.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
"""
2+
Creating sidebar-like layouts with UIBoxLayout
3+
4+
This example creates left, right, top, and bottom bars by combining the following:
5+
6+
* Placing box layouts inside other box layouts (see the box_layouts example)
7+
* Size hints (see the size_hints example)
8+
9+
To turn this into a real UI, you can replace the UIDummy widgets with layout
10+
objects which contain other widgets.
11+
12+
If arcade and Python are properly installed, you can run this example with:
13+
python -m arcade.gui.examples.side_bars_with_box_layout
14+
"""
115
import arcade
216
from arcade.gui import UIManager, UIDummy, UIBoxLayout
317

arcade/gui/examples/size_hints.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
"""
2-
Example shows how to use UIAnchorWidget to position widgets on screen.
3-
Dummy widgets indicate hovered, pressed and clicked.
4-
"""
2+
Sizing widgets using size hint keyword arguments
3+
4+
The following keyword arguments can be used to set preferred size
5+
information for layouts which arrange widgets
6+
7+
* size_hint
8+
* size_hint_max
9+
* size_hint_min
510
11+
Please note the following:
12+
13+
* These do nothing outside a layout
14+
* They are only hints, and do not guarantee a specific size will
15+
always be set.
16+
17+
If arcade and Python are properly installed, you can run this example with:
18+
python -m arcade.gui.examples.size_hints
19+
"""
620
import arcade
721
from arcade.gui import UIManager, UIBoxLayout
822
from arcade.gui.widgets import UIDummy

0 commit comments

Comments
 (0)